Thanks for taking the time to post here Joshua!

The main reason why I asked to gather feedback from this list is that I'm 
not convinced
that the benefits outweighs the additional complexity this will add to the 
already quite
loaded update_or_create() signature handling and how the fact a callable 
is not something that is used anywhere else in Django AFAIK.

The fact this can be achieved with the same number of queries by doing a
save(update_fields) from the return value of a previous get_or_create with a
bit of boilerplate[0] pushes me to a -1 because I don't think it's a common 
pattern to warrant the addition of a specialized option.



Le vendredi 28 décembre 2018 11:15:33 UTC-5, Joshua Cannon a écrit :
> Howdy folks!
> At the suggestion of Simon Charette, I'd like to get feedback on how the 
> community feels about the feature request #30053 
> <>.
> The gist of the problem is that sometimes the "update" part of 
> "update_or_create" should be conditional. The proposed solution adds a 
> backwards-compatible "update_condition" parameter to "update_or_create" 
> which should be a unary callable that takes in the retrieved table instance 
> and returns a boolean of whether the update should be performed.
> Nasir Hussain has already started work on a possible solution on PR 10800 
> <>.
> I'd love to hear other people's thoughts.

You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to