#9029: `get_or_create` broken due to inconsistent behaviour between `create` and
`filter` on Manager, RelatedManager, QuerySet, etc.
---------------------------------------------------+------------------------
          Reporter:  mrmachine                     |         Owner:  nobody     
                               
            Status:  new                           |     Milestone:             
                               
         Component:  Database layer (models, ORM)  |       Version:  SVN        
                               
        Resolution:                                |      Keywords:  
get_or_create get create filter FieldError
             Stage:  Accepted                      |     Has_patch:  0          
                               
        Needs_docs:  0                             |   Needs_tests:  0          
                               
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by jacob):

  * stage:  Unreviewed => Accepted

Comment:

 Julian's right that `Model.objects.get_or_create(related__id=N,
 defaults={'related': related_instance})` works and is an acceptable-if-
 ugly workaround.

 However, there's no reason not to make the test given in the patch work,
 so I'm marking this accepted. If someone wants to work on it, the place to
 look is in the `QuerySet` implementation.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9029#comment:3>
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