1 from django.conf import settings
2 from django.template import Library
8 @register.inclusion_tag('experiments/switch.html', takes_context=True)
9 def experiments_switcher(context):
12 for exp in settings.EXPERIMENTS:
13 currval = context['request'].EXPERIMENTS.get(exp['slug'])
14 if exp.get('switchable') or context.get('EXPERIMENTS_SWITCHABLE_' + test['slug']):
15 tests.append((exp, currval))
16 for cohort in exp.get('cohorts'):
17 if cohort.get('explicit') and cohort.get('value') == currval: