tags:

views:

12

answers:

0

I am working with a generic view in Django. I want to capture a named group parameter in the URL and pass the value to the URL pattern dictionary. For example, in the URLConf below, I want to capture the parent_slug value in the URL and pass it to the queryset dictionary value like so:

urlpatterns = patterns('django.views.generic.list_detail',
    (r'^(?P<parent_slugs>[-\w])$', 'object_list', {'queryset':Promotion.objects.filter(category=parent_slug)}, 'promo_promotion_list'),
)

Is this possible to do in one URLConf entry, or would it be wiser if I create a custom view to capture the value and pass the queryset directly to the generic view from my overridden view?