diff --git a/README.rst b/README.rst index 312c58f8..c352cfc9 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,23 @@ pip is still the recommended way to install dependencies: pip install -e . +Add the context processors in your settings: + +.. code-block:: python + + TEMPLATES = [ + { + 'OPTIONS': { + 'context_processors': [ + 'experiments.context_processors.experiments' + ], + }, + }, + ] + +Used to check how to display the result list. + + Dependencies ------------ - `Django `_ @@ -97,6 +114,13 @@ If you want to use the built in retention goals you will need to include the ret *Note, more configuration options are detailed below.* +If you use django-suit add a configuration variable: + +.. code-block:: python + + USE_DJANGO_SUIT = True + +To fix the display of result list. Experiments and Alternatives ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/experiments/conf.py b/experiments/conf.py index 19c15d02..487cc2b1 100644 --- a/experiments/conf.py +++ b/experiments/conf.py @@ -24,3 +24,4 @@ CONFIRM_HUMAN_SESSION_KEY = getattr(settings, 'EXPERIMENTS_CONFIRM_HUMAN_SESSION_KEY', 'experiments_verified_human') BOT_REGEX = re.compile("(Baidu|Gigabot|Googlebot|YandexBot|AhrefsBot|TVersity|libwww-perl|Yeti|lwp-trivial|msnbot|bingbot|facebookexternalhit|Twitterbot|Twitmunin|SiteUptime|TwitterFeed|Slurp|WordPress|ZIBB|ZyBorg)", re.IGNORECASE) +USE_DJANGO_SUIT = getattr(settings, 'USE_DJANGO_SUIT', False) diff --git a/experiments/context_processors.py b/experiments/context_processors.py new file mode 100644 index 00000000..8aa48900 --- /dev/null +++ b/experiments/context_processors.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +from experiments.conf import USE_DJANGO_SUIT + + +def experiments(request): + """To check if django suit is used""" + return {'use_django_suit': USE_DJANGO_SUIT} diff --git a/experiments/templates/admin/experiments/change_form.html b/experiments/templates/admin/experiments/change_form.html index 5bad85c5..15bc6896 100644 --- a/experiments/templates/admin/experiments/change_form.html +++ b/experiments/templates/admin/experiments/change_form.html @@ -8,9 +8,11 @@ {% if original %}
{{ original.start_date }} ‐ {% if original.end_date %}{{ original.end_date }}{% else %}now{% endif %}
-
- {% include "admin/experiments/results_table.html" %} -
+ {% if not use_django_suit %} +
+ {% include "admin/experiments/results_table.html" %} +
+ {% endif %} {% endif %} {% endblock object-tools %} @@ -55,3 +57,11 @@

Relevant Goals

{% endblock after_field_sets %} + +{% block after_related_objects %} + {% if use_django_suit %} +
+ {% include "admin/experiments/results_table.html" %} +
+ {% endif %} +{% endblock %}