Contents

조회 수 3693 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Python Django, view의 response 에서 cookie 세팅

template의 request에서 cookie 읽기


In your views:

def process_response(self, request, response):
response.set_cookie('changed', 'yes')
response.set_cookie('choose', request.LANGUAGE_CODE)
return response

And in your template:

{{ request.COOKIES.cookie_name }}


And using if-statements in your template:

{% if request.COOKIES.cookie_name == 'name' %}



?

  1. [펌] 마이크로서비스, 모노리포, SRE, ... 덮어놓고 구글 따라하면 안 되는 기술들

  2. [js] Text 값을 클립보드에 복사하기

  3. Apache CORS 설정

  4. How to Install and Use wget on Mac

  5. [mac] VirtualBox 실행 스크립트와 bash_profile 설정

  6. [linux] wget 명령 사용 예제

  7. [linux] The Ultimate Wget Download Guide With 15 Awesome Examples

  8. [sh] 쉘스크립트 if 비교 연산

  9. [sh] html 안에 있는 img 다운 받는 쉘 스크립트

  10. [ios] Start developing your navigation app for CarPlay without enrollment

  11. Configure Postfix to Use Gmail SMTP on Ubuntu 18.04

  12. RPA란? 어디에 어떻게 쓰이고 누가 만드나?

Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 99 Next
/ 99