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 wrapping the Q on the condition of isnumeric:
(Q(org_name=criteria) | (Q(org_number=int(criteria)) if
criteria.isnumeric() else False)
/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/8ecf0bbc-5fe2-4101-864a-153f33748c23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.