#!/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')