Opened 9 years ago

Closed 9 years ago

Last modified 4 years ago

#1722 closed enhancement (wontfix)

[patch] Exclude filter for the admin

Reported by: [530] Owned by: adrian
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)

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 9 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 9 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 9 years ago by anonymous

comment:2 Changed 9 years ago by anonymous

  • priority changed from high to normal

comment:3 Changed 9 years ago by mir@…

  • Summary changed from Exclude filter for the admin to [patch] Exclude filter for the admin

There's a patch provided, adding [patch]

comment:4 Changed 9 years ago by adrian

  • Description modified (diff)

What does this do?

comment:5 Changed 9 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 9 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 9 years ago by Gary Wilson <gary.wilson@…>

  • milestone changed from Version 0.93 to Version 1.0

0.93 has come and gone.

comment:8 Changed 9 years ago by anonymous

  • milestone Version 1.0 deleted

Milestone Version 1.0 deleted

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

  • Resolution set to wontfix
  • Status changed from new to closed
  • Triage Stage changed from Unreviewed to Design decision needed
  • Version changed from magic-removal to SVN

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 4 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 4 years ago by velmont

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