#23617: The new UUID field does not allow to automatically generate a UUID on 
save
-------------------------------------+-------------------------------------
     Reporter:  thedrow              |                    Owner:  zedr
         Type:  New feature          |                   Status:  closed
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |  worksforme
     Keywords:                       |             Triage Stage:
    Has patch:  0                    |  Unreviewed
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  0                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 There is a distinction between how AutoField and UUIDField work. For
 pk=AutoField `MyModel(pk=None, another_field='some_value').save()` will
 create a new pk value, but for pk=UUIDField `MyModel(pk=None,
 another_field='some_value').save()` will try to save the None value to the
 database, resulting in primary key constraint error. IMO it would be
 better if UUIDField worked similarly to AutoField. This could be achieved
 by generating a new uuid value before save if the pk value is None.

--
Ticket URL: <https://code.djangoproject.com/ticket/23617#comment:5>
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/065.dc13131a8ead40d74519a3e8bbd6d622%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to