diff --git a/docs/usage_guide.rst b/docs/usage_guide.rst index 64db8ae..8afc158 100644 --- a/docs/usage_guide.rst +++ b/docs/usage_guide.rst @@ -75,18 +75,18 @@ Method 2: Create a StreamField block Method 3: Create a template block ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You can add a template block that only shows it's contents to users of a +You can add a template block that only shows its contents to users of a specific segment. This is done using the "segment" block. -When editing templates make sure to add the `wagtail_personalisation_tags` -tag to the template:: +When editing templates make sure to load the ``wagtail_personalisation_tags`` +tags library in the template:: {% load wagtail_personalisation_tags %} After that you can add a template block with the name of the segment you want the content to show up for:: - {% segment name="My Segment"} + {% segment name="My Segment" %}
Only users within "My Segment" see this!
{% endsegment %} diff --git a/src/wagtail_personalisation/templatetags/wagtail_personalisation_tags.py b/src/wagtail_personalisation/templatetags/wagtail_personalisation_tags.py index 3d2b570..00e166c 100644 --- a/src/wagtail_personalisation/templatetags/wagtail_personalisation_tags.py +++ b/src/wagtail_personalisation/templatetags/wagtail_personalisation_tags.py @@ -10,9 +10,7 @@ register = template.Library() def do_segment(parser, token): - """Block that only shows content if user is in chosen segment. - - """ + """Block that only shows content if user is in chosen segment.""" # Parse the tag tag_name, _, kwargs = parse_tag(token, parser) @@ -33,9 +31,9 @@ register.tag('segment', do_segment) class SegmentNode(template.Node): """Node that only returns contents if user is in the segment. - This node checks if the chosen segment exists and if the - user has been segmented in the chosen segment. - If not it will return nothing + This node checks if the chosen segment exists and if the + user has been segmented in the chosen segment. + If not it will return nothing """ def __init__(self, nodelist, name): diff --git a/src/wagtail_personalisation/utils.py b/src/wagtail_personalisation/utils.py index 571d395..50d15d1 100644 --- a/src/wagtail_personalisation/utils.py +++ b/src/wagtail_personalisation/utils.py @@ -3,7 +3,6 @@ import time from django.template.base import FilterExpression, kwarg_re from django.utils import timezone - def impersonate_other_page(page, other_page): """Function to change the page metadata so the user gets to see the non-personalized path and page.