I work with a general view in Django. I want to capture the named parameter of the group in the URL and pass the value to the dictionary of URL patterns. For example, in URLConf below, I want to write a value parent_slugto a URL and pass it to the value of the query dictionary like this:
urlpatterns = patterns('django.views.generic.list_detail',
(r'^(?P<parent_slug>[-\w]+)$',
'object_list',
{'queryset':Promotion.objects.filter(category=parent_slug)},
'promo_promotion_list',
),
)
Is it possible to do this in a single URLConf record, or would it be more reasonable to create a custom view to capture the value and pass the request directly to the general view from my overridden view?
source
share