Opened 19 years ago

Closed 19 years ago

#966 closed enhancement (fixed)

[patch] add 'not'-variants to some lookup kwargs

Reported by: hugo Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently there are no 'inotcontains', 'notcontains', 'notstartswith', 'notendswith' queries which makes it awkward if you want to build a query that searches for all stuff that includes 'foo' but doesn't include 'bar' - you need to fetch IDs and filter IDs based on those results yourself.

This could be done in two ways: either just add those query lookup kwargs to the backends (mapping them to the matching NOT LIKE clauses) or enhance the AND/OR combinator syntax by introducing not handling (creating a Qnot object that will render as NOT(condition) in the SQL). The first version is much easier to do and fit's nicely into the current kwarg-based query syntax, so I would opt for that version.

Attachments (1)

notlike.diff (3.5 KB ) - added by hugo 19 years ago.
add notcontains and friends

Download all attachments as: .zip

Change History (5)

by hugo, 19 years ago

Attachment: notlike.diff added

add notcontains and friends

comment:1 by hugo, 19 years ago

Summary: add 'not'-variants to some lookup kwargs[patch] add 'not'-variants to some lookup kwargs

comment:2 by hugo, 19 years ago

Resolution: fixed
Status: newclosed

accidentely fixed in [1534]

comment:3 by hugo, 19 years ago

Resolution: fixed
Status: closedreopened

reverted changes in SVN and reopened ticket

comment:4 by Jacob, 19 years ago

Resolution: fixed
Status: reopenedclosed

(In [2422]) Added QuerySet.exclude() which does the opposite of QuerySet.filter(). As a side effect, the "ne" lookup type no longer exists. This fixes #966.

Note: See TracTickets for help on using tickets.
Back to Top