Skip to content

Commit

Permalink
Add naturaltime for active segments
Browse files Browse the repository at this point in the history
  • Loading branch information
robmoorman committed May 31, 2017
1 parent 9705947 commit fab44d2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ To install the package with pip::

pip install wagtail-personalisation

Next, include the ``wagtail_personalisation`` and
``wagtail.contrib.modeladmin`` app in your project's ``INSTALLED_APPS``:
Next, add the required apps in your ``INSTALLED_APPS`` setting:

.. code-block:: python
INSTALLED_APPS = [
# ...
# Required apps
'django.contrib.humanize',
'wagtail.contrib.modeladmin',
'wagtail_personalisation',
# ...
]
Make sure that ``django.contrib.sessions.middleware.SessionMiddleware`` has
Expand Down
6 changes: 3 additions & 3 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ The Wagxperience app runs in the Wagtail CMS. You can find out more here_.

pip install wagtail-personalisation

2. Add the module and ``wagtail.contrib.modeladmin`` to your ``INSTALLED_APPS``::
2. Add the required apps in your ``INSTALLED_APPS`` setting::

INSTALLED_APPS = [
# ...
# Required apps
'django.contrib.humanize',
'wagtail.contrib.modeladmin',
'wagtail_personalisation',
# ...
]

3. Update your database::
Expand Down
1 change: 1 addition & 0 deletions sandbox/sandbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "modeladmin/wagtail_personalisation/segment/base.html" %}
{% load i18n l10n staticfiles modeladmin_tags wagtail_personalisation_filters %}
{% load humanize i18n l10n staticfiles modeladmin_tags wagtail_personalisation_filters %}

{% block toggle_view %}to List {% endblock%}

Expand Down Expand Up @@ -31,8 +31,8 @@ <h2>{{ segment }}</h2>
<span>{{ segment.visit_count|localize }} {% trans "time" %}{{ segment.visit_count|pluralize }}</span>
</li>
<li class="days_stat">
{% trans "This segment has been active for" %}
<span>{{ segment.enable_date|days_since:segment.disable_date }} {% trans "day" %}{{ segment.enable_date|days_since:segment.disable_date|pluralize }}</span>
{% trans "This segment has been active since" %}
<span>{{ segment.enable_date|naturaltime }}</span>
</li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions tests/sandbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
Expand Down

0 comments on commit fab44d2

Please sign in to comment.