Skip to content

Commit

Permalink
[Core] Add the support of django-suit to fix the display of the result
Browse files Browse the repository at this point in the history
list (fixes mixcloud#176).
  • Loading branch information
hobbestigrou committed Feb 23, 2018
1 parent ec1982a commit 181dfa5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
24 changes: 24 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/django/django/>`_
Expand Down Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions experiments/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 7 additions & 0 deletions experiments/context_processors.py
Original file line number Diff line number Diff line change
@@ -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}
16 changes: 13 additions & 3 deletions experiments/templates/admin/experiments/change_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
{% if original %}
<h5 class="experiment-dates">{{ original.start_date }} &dash; {% if original.end_date %}{{ original.end_date }}{% else %}now{% endif %}</h5>

<div class="module experiment-results-container">
{% include "admin/experiments/results_table.html" %}
</div>
{% if not use_django_suit %}
<div class="module experiment-results-container">
{% include "admin/experiments/results_table.html" %}
</div>
{% endif %}
{% endif %}
{% endblock object-tools %}

Expand Down Expand Up @@ -55,3 +57,11 @@ <h2>Relevant Goals</h2>
</fieldset>
</div>
{% endblock after_field_sets %}

{% block after_related_objects %}
{% if use_django_suit %}
<div class="module experiment-results-container">
{% include "admin/experiments/results_table.html" %}
</div>
{% endif %}
{% endblock %}

0 comments on commit 181dfa5

Please sign in to comment.