#29747: Django 2.1.1 : UUID in loaddata fixture raise ValidationError on objects
having OneToOne relationship (uuid as FK).
-------------------------------------+-------------------------------------
     Reporter:  stockersky           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  2.1
     Severity:  Normal               |               Resolution:
     Keywords:  uuid fixture         |             Triage Stage:
  loaddata OneToOne                  |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by stockersky):

 models :


 {{{
 import uuid
 from django.db import models

 class MyClass1(models.Model):
     id = models.UUIDField(primary_key=True, default=uuid.uuid4,
 editable=False)
     name = models.CharField(max_length=20)

 class MyClass2(models.Model):
     name = models.CharField(max_length=20)
     myclass1 = models.OneToOneField(MyClass1, on_delete=models.CASCADE,
 primary_key=True)
 }}}

 Fixture :


 {{{
 [
     {
         "model": "my_app.MyClass1",
         "pk": "7bc3c004-05d6-4d4d-a70b-cf0507320784",
         "fields": {
             "name": "blabla"
         }
     },
     {
         "model": "my_app.MyClass2",
         "pk": "20",
         "fields": {
             "name": "blibli",
             "myclass1": "7bc3c004-05d6-4d4d-a70b-cf0507320784"
         }
     }
 ]
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29747#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.29bf29289a634c8b711c0c8414d10db8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to