Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Add the support of django-suit to fix the display of the result #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 %}