Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#671 closed enhancement (wontfix)

generic list_object enhancement

Reported by: ian@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords:
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I would like the generic list_object view to be able to take query parameters to filter out the object_list.

ie something like (for the polls app)

?poll_namecontains=foo
or
?poll_name
exact=blah

now I understand I can subclass the view and do this..
but I thought it would be nice to have in the default generic view as it will make prototyping SO much faster for me.

Attachments (1)

filter.py (1.3 KB) - added by ian@… 11 years ago.
modifcation of hugo's IRC log filter

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by ian@…

Attachment: filter.py added

modifcation of hugo's IRC log filter

comment:1 Changed 11 years ago by ian@…

the attachment is a wrapper which will take the query args passed by the browser and apply them to as 'extra keywords' IF the field name exist.

props to hugo for the general code.

comment:2 Changed 11 years ago by hugo

#667 would make this much easier in that you can just register a callback for extra_lookup_kwargs that get's the request and the url-based kwargs for the viewfunction and returns a dictionary of key/value pairs to merge into the lookup keyword parameters. That way your callback can look at the GET variables and modify the selection accordingly.

comment:3 Changed 11 years ago by Adrian Holovaty

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top