#19463: Add UUID Field to core
-------------------------------------+-------------------------------------
     Reporter:  guettli              |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  1.4
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by akaariai):

 I've been thinking that we would likely want to have a new field type:
 GeneratedField. This is like AutoField - the field gets a value on save()
 if it doesn't already have a value, and this field type is always a
 primary key (I am not 100% sure of the PK requirement, but it could
 simplify things). GeneratedField would have a backing field (the db
 storage type) and some generator, where the generator could fetch the
 value from DB using RETURNING, could generate the value in Python (like
 default, but with access to connection), or it could fetch the value after
 save from the DB (AutoField does this using select currval(someseq) on
 some backends).

 I think such a field type would cover a lot of requests we have currently
 - unsigned serial fields, tiny/big/...integer serial fields, UUID fields
 (no matter what the UUID generator function is), and likely some more.

 I don't know how hard such a field will be to write, or what the exact API
 should be - so this is mostly hand waving at the moment. Still, it seems
 there are only two public API places where this would affect current code
 - model.save() and bulk_create(), so it seems this should not be totally
 out of reach as a feature.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19463#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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to