Let's say in my Django project I have two models A and B.

class A(models.Model):
    something...

class B(models.Model):
    a = models.ForeignKey(A)

Later on I decided to use uuid as the primary key value. so I update the 
models:

import uuid

class A(models.Model):
     id = models.UUIDField(
         db_index=True,
         default=uuid.uuid4,
         editable=False
    )


class B(models.Model):
     id = models.UUIDField(
         db_index=True,
         default=uuid.uuid4,
         editable=False
    )

    a = models.ForeignKey(A)

Now if I make a migration, Django will NOT pick the changes with the 
foreign key, i.e the type of fk *B.a* needs to be updated to uuid as well, 
not integer anymore.

Is this a bug with current version of Django? What is the best practice for 
handling such case?

Thanks,
Liuyang


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a68ab6ce-a1c1-42a8-b3d8-82a30edb1079%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to