And the documentation suggests that if you do have a field named defaults
and you want to use it with get_or_create, you should use defaults__exact.
I don't see why a similar solution wouldn't work for other queryset methods.


2014-03-17 11:20 GMT+02:00 Gwildor Sok <[email protected]>:

> Actually, at the moment you can't have a column named "defaults" either if
> you want to use your model with the current get_or_create function, so
> naming a keyword argument like that is not that uncommon.
>
>
> On Sunday, March 16, 2014 6:39:47 PM UTC+1, Cal Leeming [Simplicity Media
> Ltd] wrote:
>
>> Still waiting for other people to chime in on this thread, but so far I'm
>> not seeing any argument against the explained logic for having
>> `.get_or_none()`.
>>
>> Comments appear to be more regarding how not to do it, rather than not
>> doing it at all.
>>
>> Ultimately this either needs someone to find a flaw in my logic (have I
>> missed anything?), or needs a BDFL decision.
>>
>> If all this needs to get approved is a patch, then I'll be happy to do so.
>>
>> Cal
>>
>>
>>
>>
>> On Sat, Mar 15, 2014 at 5:06 PM, Shai Berger <[email protected]> wrote:
>>
>>> There is a family of names that would be valid -- names that cannot be
>>> used to
>>> name fields -- and that is names that begin with dunder.
>>>
>>> I would like to see neither get(__default=x) nor first(__only=True) -- I
>>> think
>>> that's quite ugly -- I just want to remind us that technically, the
>>> option
>>> exists.
>>>
>>> On Friday 14 March 2014 12:40:25 Michael Manfre wrote:
>>> > Good point. I forgot that some people would do that.
>>> >
>>> >
>>> > On Fri, Mar 14, 2014 at 11:52 AM, Florian Apolloner
>>> >
>>> > <[email protected]>wrote:
>>>
>>> > > On Friday, March 14, 2014 4:50:49 PM UTC+1, Michael Manfre wrote:
>>> > >> On Fri, Mar 14, 2014 at 11:15 AM, Cal Leeming [Simplicity Media
>>> Ltd] <
>>> > >>
>>> > >> [email protected]> wrote:
>>> > >>>> .get(or=None) (of some description) would be my preference, but
>>> even
>>> > >>>> that is ugly and confuses the existing API with "special"
>>> keywords that
>>> > >>>> aren't actually a filter.
>>> > >>>
>>> > >>> I would be strong -1 on having a special keyword.
>>> > >>
>>> > >> Even if the special keyword is 'default'? .get(..., default=None)
>>> is a
>>> > >> common python pattern that fits well with this usage.
>>> > >
>>> > > Yes, especially 'default' -- which is a perfectly valid name for a
>>> table
>>> > > column.
>>> > >
>>> > > --
>>> > > You received this message because you are subscribed to the Google
>>> Groups
>>> > > "Django developers" 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 http://groups.google.com/group/django-developers
>>> .
>>> > > To view this discussion on the web visit
>>> > > https://groups.google.com/d/msgid/django-developers/
>>> 4aa7d1e3-4fb3-429e-a95
>>> > > a-6e52cc9b511a%40googlegroups.com<https://groups.google.com/
>>> d/msgid/django
>>> > > -developers/4aa7d1e3-4fb3-429e-a95a-6e52cc9b511a%40googl
>>> egroups.com?utm_me
>>> > > dium=email&utm_source=footer> .
>>> > >
>>> > > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers" 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 http://groups.google.com/group/django-developers.
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/django-developers/3039581.NUMVpPu4sL%40deblack.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django developers" 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 http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/3623f921-4c6f-4e5f-af9a-fc8e5d656c5b%40googlegroups.com<https://groups.google.com/d/msgid/django-developers/3623f921-4c6f-4e5f-af9a-fc8e5d656c5b%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Adam Mesha <[email protected]>
Life is either a daring adventure, or nothing. - Helen Keller

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" 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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAPFOCZdmZaQjw9LaqT1BczNPuuu1OageEjw%3DDfrArDV5RbMpgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to