#23572: Exception on Custom Lookups when right value is None.
----------------------------------------------+----------------------------
Reporter: maherma-adg | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.7
Severity: Normal | Keywords: custom lookup,
Triage Stage: Unreviewed | db
Easy pickings: 0 | Has patch: 0
| UI/UX: 0
----------------------------------------------+----------------------------
For my current project I need generate a complex queryset filter and I
decide implement as custom lookup.
I got the [https://docs.djangoproject.com/en/1.7/howto/custom-lookups/,
example] as base to create custom lookup, but during test, this expresion:
data = Rsce.filter(duration{{{__}}}ne = None)
throw an exception. Any other expresion run smoothly.
Looking into code exception are thrown in this piece of code:
if value is None:
if lookups[-1] not in ('exact', 'iexact'):
raise ValueError("Cannot use None as a query value")
IMHO the check in lookups must be avoided on custom lookups, allowing them
to manage None values by themselves.
--
Ticket URL: <https://code.djangoproject.com/ticket/23572>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.c8ea9250e668cd1b63c4286c7c4bd493%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.