Develop
2019.12.06 10:33
[python][django] request.cookie 읽어오기 ㅋㅋㅋ (쓰기)
조회 수 1703 댓글 0
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' %}
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
62 | Etc | IPR 특허 관련 | hooni | 2015.04.28 | 0 |
61 | Etc | 플라스터(Plaster) 수업 내용 | hooni | 2016.05.24 | 0 |
60 | Etc | 영어 관련 토렌트 | hooni | 2013.06.25 | 0 |
59 | Etc | 웹 보안 논문 주제 2016 | hooni | 2016.11.28 | 0 |
58 | Etc | 종합시험 관련 자료 | hooni | 2017.03.15 | 0 |
57 | Etc | 영어 아주 쉬운 영작문 강의 01~60 | hooni | 2013.06.25 | 0 |
56 | Etc | 사이버보안실무 시험. | hooni | 2017.04.20 | 0 |
55 | Etc | IoT가 만드는 미래와 플랫폼 경쟁력 | hooni | 2014.09.23 | 0 |
54 | Etc | [eng] 숙제 ㅋㅋㅋ | hooni | 2015.10.14 | 1 |
53 | Etc | WM미통기 - 10. 조건부확률 | hooni | 2015.04.20 | 720 |
52 | Etc | 사이버보안실무 수업 메모 | hooni | 2017.03.30 | 829 |
51 | Etc | 수리통계학 : 표본공간과 사상-1 | hooni | 2015.04.20 | 913 |