Opened 14 years ago

Closed 13 years ago

Last modified 9 years ago

#1722 closed enhancement (wontfix)

[patch] Exclude filter for the admin

Reported by: [530] Owned by: Adrian Holovaty
Component: contrib.admin Version: master
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 14 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 14 years ago by anonymous

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.

Changed 14 years ago by anonymous

Attachment: exclude_in_admin.diff added

comment:2 Changed 14 years ago by anonymous

priority: highnormal

comment:3 Changed 14 years ago by mir@…

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

There's a patch provided, adding [patch]

comment:4 Changed 14 years ago by Adrian Holovaty

Description: modified (diff)

What does this do?

comment:5 Changed 14 years ago by [530]

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 Changed 14 years ago by Jacob

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 Changed 14 years ago by Gary Wilson <gary.wilson@…>

milestone: Version 0.93Version 1.0

0.93 has come and gone.

comment:8 Changed 13 years ago by (none)

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:9 Changed 13 years ago by Simon G. <dev@…>

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 Changed 9 years ago by lambdaq@…

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 Changed 9 years ago by Odin Hørthe Omdal

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