Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django url parameters into context_processor

I have this Django Url:

url( r'^(?P<language>.*)/(?P<shop>.*)/(?P<brand>.*)/$', 'app.views.view_1' ),

Now, "language", "shop", "brand" are all parameters into my url and I want to read them into my custom Django Context Processor. How can I do it?

Thanks.

like image 429
Gabriele Morgante Avatar asked Dec 09 '14 20:12

Gabriele Morgante


1 Answers

You can access request.resolver_match from the context processor. This will give you access to the resolved url parameters in request.resolver_match.kwargs

like image 151
Harel Avatar answered Oct 05 '22 12:10

Harel