Opened 19 years ago

Closed 18 years ago

Last modified 13 years ago

#1722 closed enhancement (wontfix)

[patch] Exclude filter for the admin

Reported by: [530] Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adrian Holovaty)

class Amodel(models.Model):

    field = models.ManyToMany(SomeOtherModel)

    class Admin:
        list_filter = ('-field') # just like ordering

Attachments (1)

exclude_in_admin.diff (6.2 KB ) - added by anonymous 19 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 by anonymous, 19 years ago

Typo in example

class Amodel(models.Model):

    field = models.ManyToManyField(SomeOtherModel)

    class Admin:
        list_filter = ('-field') # just like ordering

Missing: Should also raise a not implemented error for date and booleanfields.

by anonymous, 19 years ago

Attachment: exclude_in_admin.diff added

comment:2 by anonymous, 19 years ago

priority: highnormal

comment:3 by mir@…, 19 years ago

Summary: Exclude filter for the admin[patch] Exclude filter for the admin

There's a patch provided, adding [patch]

comment:4 by Adrian Holovaty, 19 years ago

Description: modified (diff)

What does this do?

comment:5 by [530], 19 years ago

Instead of filtering the result in the admin it excludes, so you can get the results not matching that particular choice, foreignkey, manytomany relation.

comment:6 by Jacob, 18 years ago

Like Adrian, I had trouble figuring out what the -field syntax actually did. The fact that neither Adrian nor I could understand what this does at first glance implies it needs a bit more thought. I'm +0 on the concept, however, so perhaps you can come up with a more obvious implementation?

comment:7 by Gary Wilson <gary.wilson@…>, 18 years ago

milestone: Version 0.93Version 1.0

0.93 has come and gone.

comment:8 by (none), 18 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:9 by Simon G. <dev@…>, 18 years ago

Resolution: wontfix
Status: newclosed
Triage Stage: UnreviewedDesign decision needed
Version: magic-removalSVN

Marking as wontfix given the comments above. If someone can provide a good example of how/when this would be useful, then please reopen.

comment:10 by lambdaq@…, 13 years ago

Easy pickings: unset
Has patch: unset
UI/UX: unset

So let's say we have a Posts model, it has a field called Flag, Flag can have a tri-status: normal, sticky, and obsolete, now I show only posts other than obsolete. How can I do that easily in Django admin?

comment:11 by Odin Hørthe Omdal, 13 years ago

This can now probably be done using custom filters. However, I want to say I need something like this.

I'm doing filtering on member__options and some of those options are don't send email (pk 42). I want to list (in the admin) all the members who *don't* belong in the don't send email-group. (So, the people I *can* send email to)

So really, having ?member__options__not=42 do it's magic would be swell.
.

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