#30053: Allow for conditional QuerySet.update_or_create()
-------------------------------------+-------------------------------------
     Reporter:  Joshua Cannon        |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  QuerySet             |             Triage Stage:
  update_or_create                   |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Joshua Cannon):

 Replying to [comment:2 Simon Charette]:
 > Could you detail your use case a bit more? I'm not sure I understand how
 adding a condition to the `if created` statement would allow you to put
 updates behind a condition given it's only reached when the row gets
 created.
 >
 > Also, have you experimented with chaining `filter().update_or_create()`
 to limit its application to a filtered domain?

 Oohh. good observation (See, I'm already introducing bugs in my solution
 and I'm aware of the problem!). Modified the details.

 Also, no I haven't. Assuming that works and behaves as expected that might
 be the solution I'm looking for. If that's the case, perhaps a note in the
 documentation would be beneficial to novice/intermediate developers like
 myself.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30053#comment:4>
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/068.9e96494e9b1922489261684e2017e385%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to