#35957: Allow AutoFields in composite primary keys
-------------------------------------+-------------------------------------
     Reporter:  Csirmaz Bendegúz     |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Csirmaz Bendegúz):

 No, it's the opposite. The goal is to make `AutoField`s work with
 composite primary keys. It's not Postgres-specific, this would work with
 all database backends (except SQLite).

 The difference between #8576 and this is that this ticket won't allow
 multiple `AutoField`s. A model can only have one `AutoField`, and that
 `AutoField` must be a primary key, or must be part of a composite primary
 key.

 e.g.:

 {{{
 class Foo(models.Model):
     pk = models.CompositePrimaryKey("bar", "id", primary_key=True)
     bar = models.CharField(max_length=255)
     id = models.AutoField()
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35957#comment:2>
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 visit 
https://groups.google.com/d/msgid/django-updates/010701938bc33759-4239f7a2-b74e-4bfb-90b0-ea6f6fcd8327-000000%40eu-central-1.amazonses.com.

Reply via email to