Titivillus/set_session/views.py

16 lines
398 B
Python

#!/usr/bin/env python3
"""
/set_session app views.
"""
from django.http import HttpResponse
def index(request):
"""
A simple API endpoint for setting certain values in the users session.
"""
if request.POST.get('hide_header') == 'on':
request.session['hide_header'] = True
elif request.POST.get('hide_header') == 'off':
request.session['hide_header'] = False
return HttpResponse('true')