Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#10665 closed (duplicate)

contrib.admin.ModelAdmin.list_filter filter by Null ForeignKey (no clear UI to filter to show only NULL values)

Reported by: dkg Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords: list_filter
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Consider a model foo with a boolean field status and a Nullable foreign key named bar. Let's say we have:

class FooAdmin(admin.ModelAdmin):
  list_filter = ('status', 'bar')

In this event, the admin list view allows filtering on the right-hand side based on which bar element is linked. But it does not seem to allow the user to filter to show only foo items which have a NULL for bar.

I'm encountering this while running django 1.0.2-1 (as shipped in debian's python-django package). This seems like it would be a pretty commonly desired query (e.g. "show me all customers with no assigned sales agent", or "show me all students with no advisor"), so i think it would be a useful addition.

See Also: This seems similar (yet not identical) to the issue raised in #7582.

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Looks like #8528.

comment:2 Changed 5 years ago by dkg

Yes, that looks right. Sorry that my initial searches failed to find #8528. Thanks for pointing in the right direction.

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.