python - Django read cookie in template tag -


Is a cookie readable in this template tag?

I have set a cookie in a middleware but I want to read in a template tag.

  def process_response (auto, request, response): response.set_cookie ('changed', 'yes') response.set_cookie ('select', request. LONGGUAGE_CODE) Return response   

thanks

you le_context < Custom_template_tag_name (context, value1, value2): request = context ['request'] result to create a template tag with register.simple_tag (le_contact = True) def = Request COOKIES.get ('cookie_name', '') return result

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -