Hi Marten,
Am 2015-11-21 um 11:53 schrieb Marten Kenbeek:
The 'con' side argument is that it would create in inconsistency in the
API, since we don't have any other negated lookups either. If we can get
the same behaviour by fixing the current API, Django should not
introduce an unnecessary consistency.
I think that this is where the communication problem is:
The "con" side seems to see a problem in the current API regarding
exclude() (personally, about what it is I only have a vague idea from
older linked discussions: NOT(...) vs. "proper" negation) and argues
that fixing the problem solves the issue and avoids inconsistency in the
API brought by the introduction of __ne.
The "pro" side sees a problem in functionality when __ne is lacking, and
cannot see how the "con" side's arguments would help. The problem in
functionality is detailed in
https://code.djangoproject.com/ticket/5763#comment:14, which essentially
quotes (possibly an older version of)
https://docs.djangoproject.com/en/1.8/topics/db/queries/#spanning-multi-valued-relationships
and shows a related example where exclude() cannot replace __ne. As we/I
cannot see how fixing/changing exclude() would help in this situation,
we keep asking about __ne. ;-)
In summary, the imaginary query of comment 14
Blog.objects.filter(entry__tag__name='django',
entry__author_count__ne=2)
seems quasi not be possible to implement in today's Django (but probably
with your suggestion below).
Anyway, with the new lookup API, it has become trivial for any project
to implement the __ne lookup. It is the first example in the how-to
guide:
https://docs.djangoproject.com/en/dev/howto/custom-lookups/#a-simple-lookup-example.
Thanks, I'll definitively check and try this out, I didn't know it before!
Best regards,
Carsten
--
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 http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/565054EA.40508%40cafu.de.
For more options, visit https://groups.google.com/d/optout.