Re: RFC: #30053 Allow for conditional QuerySet.update_or_create()

2019-01-02 Thread Collin Anderson
Seems to me a documentation example or improvement could be helpful. On Mon, Dec 31, 2018 at 11:30 AM Joshua Cannon wrote: > Personally, the snippet suggested in the ticket is sufficient for my needs > (although I'm saddened by having to duplicate the setattr logic). > However, I filed the

Re: RFC: #30053 Allow for conditional QuerySet.update_or_create()

2018-12-31 Thread Joshua Cannon
Personally, the snippet suggested in the ticket is sufficient for my needs (although I'm saddened by having to duplicate the setattr logic). However, I filed the ticket after Googling "Django conditional update_or_create" and finding no appropriate solution. You might be right about the use

Re: RFC: #30053 Allow for conditional QuerySet.update_or_create()

2018-12-28 Thread Adam Johnson
I think the use case is probably quite niche, and I'd like to know some more concrete details than the current comment on the ticket "(E.g. only update if the value of a DateTimeField is less than some value)". It may be there's a way to achieve the same application-level outcome using a different

Re: RFC: #30053 Allow for conditional QuerySet.update_or_create()

2018-12-28 Thread charettes
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

RFC: #30053 Allow for conditional QuerySet.update_or_create()

2018-12-28 Thread Joshua Cannon
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