mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-15 07:20:17 +02:00
* Split base template menus out * Add toggle for night mode setting * Add vertical flexbox row Makes each col-* expand to fill the space created by the largest column. * Use flexbox on main character and group panels * Fix data table sort control clipping * Build new css
20 lines
635 B
Python
20 lines
635 B
Python
from django.views.generic.base import View
|
|
from django.http import HttpResponseRedirect
|
|
|
|
|
|
class NightModeRedirectView(View):
|
|
SESSION_VAR = 'NIGHT_MODE'
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
request.session[self.SESSION_VAR] = not self.night_mode_state(request)
|
|
return HttpResponseRedirect(request.GET.get('next', '/'))
|
|
|
|
@classmethod
|
|
def night_mode_state(cls, request):
|
|
try:
|
|
return request.session.get(cls.SESSION_VAR, False)
|
|
except AttributeError:
|
|
# Session is middleware
|
|
# Sometimes request wont have a session attribute
|
|
return False
|