Code

Opened 8 years ago

Closed 8 years ago

#966 closed enhancement (fixed)

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

Reported by: hugo Owned by: adrian
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: UI/UX:

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 8 years ago.
add notcontains and friends

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by hugo

add notcontains and friends

comment:1 Changed 8 years ago by hugo

  • Summary changed from add 'not'-variants to some lookup kwargs to [patch] add 'not'-variants to some lookup kwargs

comment:2 Changed 8 years ago by hugo

  • Resolution set to fixed
  • Status changed from new to closed

accidentely fixed in [1534]

comment:3 Changed 8 years ago by hugo

  • Resolution fixed deleted
  • Status changed from closed to reopened

reverted changes in SVN and reopened ticket

comment:4 Changed 8 years ago by jacob

  • Resolution set to fixed
  • Status changed from reopened to closed

(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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.