#29733: update_or_create - documentation misleading
-------------------------------------+-------------------------------------
     Reporter:  David Pratten        |                    Owner:  nobody
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Documentation        |                  Version:  2.1
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 Adding the following to the `UpdateOrCreateTests` (in
 [https://github.com/django/django/tree/master/tests/get_or_create
 `get_or_create` module] does not produce a failure:

 {{{
     def test_29733(self):
         p = Person.objects.create(
             first_name='John', last_name='Lennon', birthday=date(1940, 10,
 9)
         )
         p, created = Person.objects.update_or_create(
             pk=p.pk, defaults={
                 'first_name':'John',
             }
         )
         self.assertFalse(created)
 }}}

 The `Person` model is unique on the primary key and `first_name` fields.
 (So AFAICS it should be a test case for your example.)

 As such I'm going to close this as invalid. If you can provide a failing
 test case I'm happy to re-open.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29733#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 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/070.4613a94efc93fcc3bd8f09604f4c4aa0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to