It didn't occur to me that it could be done that way. Thanks!
I'm closing the ticket as 'invalid'
On Tuesday, August 16, 2016 at 2:03:02 PM UTC-5, charettes wrote:
>
> Hi Flavio,
>
> Is there a reason we can't document chaining filter() with these methods
> when
> querying with Q() objects?
>
> Person.objects.filter(
> Q(first_name='George') | Q(first_name='Bruce')
> ).get_or_create(defaults={'last_name': 'Harrison'})
>
> If `defaults` was stil only passable as a kwarg this could have worked but
> at
> this point I don't think it's worth the additionnal complexity as there's
> no way
> to introduce a fully backward compatible API without deprecating passing
> `defaults` as the first arg.
>
> Even if we were to agree on a new unlikely used kwarg name to specify the
> query
> object the `(get|update)_or_create` APIs would end up disgressing from the
> `filter()`
> and `get()` ones which is the main objective of this proposed change I
> beleive.
>
> Simon
>
> Le mardi 16 août 2016 13:57:25 UTC-4, Flavio Curella a écrit :
>>
>> I'm thinking about adding support for `Q` to `get_or_create` and
>> `update_or_create`. I've summarized my thoughts at
>> https://code.djangoproject.com/ticket/27070.
>>
>>
>> I have a couple of unsolved question; the most critical is the one Tim
>> raises: if we were to add another keyword argument to those methods, how
>> much of an impact will it have? Can we find a name that we can be
>> reasonably confident is not used as a model field by anybody (or a _very_
>> small number of users)?
>>
>>
>> Thanks,
>> –Flavio.
>>
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/164e44aa-6133-470a-a178-438d8d772497%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.