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, so ...objects.filter(org_number__iexact = criteria) worked fine. Of course, a case-insensitive function should not be used for the purpose of avoiding a casting issue so I initially assumed that this must be an odd implementation detail that one can't rely on. Python however does permit int and string comparison (1 == "foo") without it throwing a ValueError, so which of the two behaviors is doing the right thing here? Is "__exact" being too strict with its input, or is __iexact too relaxed? The question is not purely philosophic, since ignoring type casting makes my current code a simple and short Q query with multiple OR arguments in it. /Björn Påhlsson -- 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/9e61c74d-f19b-4ea9-9f4d-ed1e395556d1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
