#8576: Multiple AutoFields in a model
---------------------------------------------------+------------------------
          Reporter:  honeyman                      |         Owner:  nobody     
       
            Status:  reopened                      |     Milestone:             
       
         Component:  Database layer (models, ORM)  |       Version:  SVN        
       
        Resolution:                                |      Keywords:  multiple 
autofield
             Stage:  Design decision needed        |     Has_patch:  0          
       
        Needs_docs:  0                             |   Needs_tests:  0          
       
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by seanmonstar):

  * status:  closed => reopened
  * has_patch:  1 => 0
  * resolution:  wontfix =>

Comment:

 while some backends can't support, at the least, PostgreSQL can. You can
 assign multiple values as "serial", only one needs to be primary key.

 And a use case where I've used (has to do with ordering):

 Say I have a bunch of pages in a CMS. The primary auto field would be the
 id.  But I also want you to be able to change the order they show up in.
 By default, the ordering should be as you create them. Meaning my
 page_order column also can't have null values, but should all be a
 sequential number. And it needs to be a different number than the id,
 since the ID doesn't ever change.

 It seems possible to check if the backend picked was one that works
 (Postgres) and if so, not assert primary_key on the AutoFields.  On
 backends where the implementation wouldn't work, you can toss an error. I
 shouldn't be stuck with MySQL functionality if I can use PostgreSQL. :)

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8576#comment:6>
Django <http://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 this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to