Reputation: 69
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.
Upvotes: 6
Views: 921
Reputation: 2039
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
Upvotes: 7
Reputation: 10305
I just tell you the idea here. When the url calls view_1
function , you have language, shop, brand values ... here why don''t you set that values into session
and get that values in Context Processor
using session
variable ..
Upvotes: 0