Changes between Initial Version and Version 1 of Ticket #2544


Ignore:
Timestamp:
Aug 22, 2006, 12:08:09 AM (18 years ago)
Author:
Adrian Holovaty
Comment:

Maybe this?

queryset_func = lambda kwargs: Item.objects.filter(name__name__iexact=kwargs['person'])

(r'^/?(?P<person>\w+)/$', 'django.views.generic.list_detail.object_list', {'queryset_func': queryset_func})

The generic view would call queryset_func(kwargs) at runtime, with kwargs being the dictionary of parameters captured from the URL.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2544 – Description

    initial v1  
    55Currently, a statement similar to the following will fail with a NameError similar to the below:
    66
    7 {{{NameError at /dave/
     7{{{
     8NameError at /dave/
    89name 'person' is not defined
    910Request Method: GET
    1011Request URL:    http://localhost:8000/dave/
    1112Exception Type: NameError
    12 Exception Value:        name 'dave' is not defined}}}
     13Exception Value:        name 'dave' is not defined
     14}}}
    1315
    1416The ideal behaviour would be that the filter function would be able to accept values from the url dispatcher.
Back to Top