Opened 12 years ago
Last modified 11 years ago
#18736 new New feature
Flexible filters for django admin
Reported by: | Olexandr Shalakhin | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | schillingt@… | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
Current django admin filters allow us to make predefined actions without any parameters be entered by user.
It would be nice to give more flexibility. I mean filters with inputs, OR, >, <, >=, <= which should allow users to make more precise filtering. Here we need also a designer.
I'd like to code it for Django project :) Assuming it will be my first huge open source effort it would be great to have supervisor to ask my questions.
best regards,
Olexandr Shalakhin
Change History (4)
comment:1 by , 12 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|---|
Type: | Uncategorized → New feature |
comment:2 by , 12 years ago
Thanks! I'll discuss it with them. I am also reading the django admin code so I think I'll find initial approach to do it. Let's do it :)
comment:3 by , 12 years ago
Triage Stage: | Design decision needed → Accepted |
---|---|
UI/UX: | set |
This sounds like a good idea.
comment:4 by , 11 years ago
Cc: | added |
---|
I took a stab at implementing this. I ended up creating a new filter class ComparisonFieldListFilter
. When using it we'll need to pass in the value to compare the field to. The easiest way (that I saw) to support this was to use a nested tuple.
list_filter = [(('rank', 50), admin.ComparisonFieldListFilter), ]
I'm assume that my code will need some modifications, so let me know what I need to change or clean up. This is just a starting point.
Commit: https://github.com/tim-schilling/django/commit/cf7138d0a5953f0b2d707de944f715f0cfdaba64
Thanks for kicking off the discussion on this. It definitely sounds interesting, but it's probably too early for this to be in Trac. There are other people who are driving the admin work forward, namely Idan and Julien. Your best bet is to try to grab them on IRC or email the django-developers and describe what it is you've got planned and how you'd like to tackle it. You can also take a stab at this and offer patches -- it's definitely easier to grok what you're suggesting when we can look at code.