X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/24721591455e048cffca365384e6759daae05916..4fb23ed3c3396d23a37a718fc857ecc8b36b0c7f:/src/experiments/views.py?ds=inline diff --git a/src/experiments/views.py b/src/experiments/views.py index 71c514acd..50c6f1e94 100644 --- a/src/experiments/views.py +++ b/src/experiments/views.py @@ -1,17 +1,13 @@ from django.views.generic import TemplateView -from django.conf import settings class MainSwitchView(TemplateView): template_name = 'experiments/main_switch.html' def get_context_data(self): - ctx = super().get_context_data() - ctx['experiments'] = [ - { - "config": conf, - "value": self.request.EXPERIMENTS.get(conf['slug']) - } - for conf in settings.EXPERIMENTS - ] - return ctx + return { + 'experiments': [ + e for e in self.request.EXPERIMENTS.values() + if e.switchable or self.request.user.is_staff + ] + }