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 wr

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, s