Re: Calling of int constructor in QuerySet

2016-02-13 Thread Shai Berger
On Sunday 14 February 2016 05:52:32 belorn mandos wrote: > On Saturday, February 13, 2016 at 9:17:34 PM UTC+1, Shai Berger wrote: > > val = int(s) if s else None > > > > will make your code clearer and safer against unexpected inputs than what > > you > > have currently, and certainly

Re: Calling of int constructor in QuerySet

2016-02-13 Thread belorn mandos
On Saturday, February 13, 2016 at 9:17:34 PM UTC+1, Shai Berger wrote: > > val = int(s) if s else None > > will make your code clearer and safer against unexpected inputs than what > you > have currently, and certainly cleaner than using __iexact. > I was thinking in the line of

Re: Calling of int constructor in QuerySet

2016-02-13 Thread Shai Berger
On Saturday 13 February 2016 12:54:55 Josh Smeaton wrote: > The iexact lookup shouldn't even be defined for number types should it? I'm > assuming it is due to backwards compatibility (from 1.7 when custom lookups > landed), but what would that even mean? If we're not able to remove iexact >

Re: Calling of int constructor in QuerySet

2016-02-13 Thread Josh Smeaton
The iexact lookup shouldn't even be defined for number types should it? I'm assuming it is due to backwards compatibility (from 1.7 when custom lookups landed), but what would that even mean? If we're not able to remove iexact lookup from number types then I would agree that it should also

Calling of int constructor in QuerySet

2016-02-12 Thread belorn mandos
When working with QuerySets and IntegerFields, I saw that comparison to a string with no digits in it throws a ValueError exception when I did ...objects.filter(org_number = criteria) or ...objects.filter(org_number__exact = criteria) However, when using iexact, it did not throw an exception,