#34151: Adding explicit primary key with different type doesn't update related
ManyToManyFields.
-------------------------------------+-------------------------------------
     Reporter:  STANISLAV LEPEKHOV   |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Migrations           |                  Version:  4.1
     Severity:  Normal               |               Resolution:
     Keywords:  migrations pk uuid   |             Triage Stage:  Accepted
  relation                           |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by STANISLAV LEPEKHOV):

 Replying to [comment:4 Mariusz Felisiak]:
 Thanks for the comments!
 I wanted to note that the problem also occurs for the models.ForeignKey
 fields.
 The migration succeeds (in the absence of links), and after adding the
 link, an exception is thrown.
 I apologize in advance for the machine translation =)

 Here is the code that will throw the exception:

 {{{
 class StoreChain(models.Model):
     places = models.ManyToManyField(Place, blank=True)

 class Place(models.Model):
     pass
 }}}
 if change to this edition (set pk with uuid type) and add relation after:
 {{{
 class StoreChain(models.Model):
     uid = models.UUIDField(default=uuid.uuid4, editable=False,
 primary_key=True, unique=True)
     place = models.ForeignKey (Place, blank=True, null=True)

 class Place(models.Model):
     uid = models.UUIDField(default=uuid.uuid4, editable=False,
 primary_key=True, unique=True)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34151#comment:6>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018467c35f9e-e1bbef6a-bab7-4ce3-8d5b-01ecfb492a13-000000%40eu-central-1.amazonses.com.

Reply via email to