Code

Opened 8 years ago

Closed 7 years ago

#2718 closed defect (duplicate)

filters in auth.models not visible in admin-interface

Reported by: patrick@… Owned by: adrian
Component: contrib.admin Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

filters defined in auth.models User don´t show up in admin-interface

Attachments (0)

Change History (8)

comment:1 Changed 8 years ago by adrian

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

Please reopen this with more information; I'm not sure what you mean.

comment:2 Changed 8 years ago by patrick@…

  • Resolution invalid deleted
  • Status changed from closed to reopened

in auth.models User:
list_filter = ('is_staff', 'is_superuser', 'is_active')

none of these filters show up in the admin-interface. I´m on the latest revision.
I have filters in other models and they work fine.

comment:3 Changed 8 years ago by adrian

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

Works for me...I'm not sure why it wouldn't be working for you. Maybe try a fresh installation?

comment:4 Changed 8 years ago by patrick@…

just did a fresh installation. however, it´s not that important. btw, I´m using OneToOne for extending the user with a user-profile. not sure if that can cause the problem.

comment:5 Changed 8 years ago by patrick@…

  • Resolution worksforme deleted
  • Status changed from closed to reopened

when you extend the user with a one-to-one userprofile, the filters don´t show up anymore (using the revision 3896)

comment:6 Changed 7 years ago by Honza Král <Honza.Kral@…>

This problem still exists. Even if I don't have a OneToOne field, I still cannot filter using some foreign keys. If I apply following patch, it works well.

Index: django/contrib/admin/views/main.py
===================================================================
--- django/contrib/admin/views/main.py  (revision 4149)
+++ django/contrib/admin/views/main.py  (working copy)
@@ -573,7 +573,7 @@
 
     def get_filters(self, request):
         filter_specs = []
-        if self.lookup_opts.admin.list_filter and not self.opts.one_to_one_field:
+        if self.lookup_opts.admin.list_filter:
             filter_fields = [self.lookup_opts.get_field(field_name) \
                               for field_name in self.lookup_opts.admin.list_filter]
             for f in filter_fields:

The other peculiar thing is that when I try and construct an instance of the model from the interactive shell, ._meta.one_to_one_field is None and the condition should not affect it... I somebody can tell me where to look, if not I can try and digg it out myself.

comment:7 Changed 7 years ago by alex@…

Same for me. Suddenly all my filters disappeared and I did not realized that was because I've used
OneToOne field. Thank you for this patch! :)

comment:8 Changed 7 years ago by anonymous

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

I believe this is duplicate to ticket:2145. Ticket:2145 provides same solution in same place for the same problem.

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.