20 lines
430 B
Python
20 lines
430 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.
|
|
"""
|
|
for key, value in request.POST.items():
|
|
if key not in ['hide_header', 'hide_chat']:
|
|
continue
|
|
if value == 'on':
|
|
request.session[key] = True
|
|
elif value == 'off':
|
|
request.session[key] = False
|
|
|
|
return HttpResponse('true')
|