Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#7625 closed (wontfix)

admin.list_filter should accept methods with boolean property

Reported by: ashley@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: metzen@…, mbonetti@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



I have a model with a start_time, end_time.
And a method that does something like this:

def overnight(self):

if self.end:

if <

return True


return False

overnight.boolean = True

It would be nice to be able to add overnight to list_filters, at least if boolean property set.

Change History (10)

comment:1 Changed 11 years ago by Ashley Camba <ashwoods@…>

Resolution: invalid
Status: newclosed

comment:2 Changed 11 years ago by Ashley Camba <ashwoods@…>

sorry, found functionality already.

comment:3 Changed 11 years ago by anonymous

Cc: metzen@… added

comment:4 Changed 11 years ago by ashley camba <stuff4ash@…>

Resolution: invalid
Status: closedreopened

comment:5 Changed 10 years ago by anonymous

Cc: mbonetti@… added

comment:6 Changed 10 years ago by Eric Holscher

Triage Stage: UnreviewedDesign decision needed

comment:7 Changed 10 years ago by simon

Resolution: wontfix
Status: reopenedclosed

I'm marking this as wontfix, because Django's filters work by generating SQL queries using the ORM - filtering on the return value of a function can't be translated in to a SQL query, so implementing this would require loading EVERY row in to the ORM and calling the function on every single one of them. This is too inefficient.

comment:8 Changed 10 years ago by ashley camba <stuff4ash@…>

Resolution: wontfix
Status: closedreopened

One posibility would be then a shortcut to be able to define filters with functions that return a queryset, and be able to add them to "list_filters".

comment:9 Changed 10 years ago by Brian Rosner

Resolution: wontfix
Status: reopenedclosed

Please don't reopen wontfixed tickets without discussion on the django-developers mailing list. The functionality described in this ticket is just not going to work due to reasonings Simon provided. There is already a ticket, #5833, that will provide a much more flexible list_filter in the future.

comment:10 Changed 10 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top