Code

Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#671 closed enhancement (wontfix)

generic list_object enhancement

Reported by: ian@… Owned by: adrian
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@… 9 years ago.
modifcation of hugo's IRC log filter

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by ian@…

modifcation of hugo's IRC log filter

comment:1 Changed 9 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 9 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 8 years ago by adrian

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

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.