, 'app.views.view_1'...">

Django url parameters in context_processor

I have this Django Url:

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

      

Now "language", "store", "brand" are all parameters in my url and I want to read them in my normal Django GPU. How can i do this?

Thank.

+3


source to share


2 answers


You can access request.resolver_match

from the context processor. This will give you access to the allowed urls parameters inrequest.resolver_match.kwargs



+3


source


I'll just give you this idea. When the url calls the function view_1

, you have the values ​​for the language, store, brand ... here why don't you set these values ​​in session

and get those values ​​in Context Processor

using a variable session

..



0


source







All Articles