kpsul/kfet/context_processors.py
2017-06-12 15:18:42 +02:00

31 lines
709 B
Python

# -*- coding: utf-8 -*-
from django.contrib.auth.context_processors import PermWrapper
from .views import KFET_OPEN, KFET_FORCE_CLOSE
from kfet.config import kfet_config
def auth(request):
if hasattr(request, 'real_user'):
return {
'user': request.real_user,
'perms': PermWrapper(request.real_user),
}
return {}
def kfet_open(request):
(kfet_open, kfet_open_date) = KFET_OPEN()
kfet_force_close = KFET_FORCE_CLOSE()
return {
'kfet_open': kfet_open,
'kfet_open_date': kfet_open_date.isoformat(),
'kfet_force_close': kfet_force_close,
}
def config(request):
return {'kfet_config': kfet_config}