7

adding personalisable StructBlock for in-page personalisation

This commit is contained in:
Pim Vernooij
2016-12-11 16:00:35 +01:00
parent 1c4062eb7e
commit ed3a9449fd

View File

@ -0,0 +1,12 @@
from wagtail.wagtailcore import blocks
from personalisation.models import Segment
class PersonalisedStructBlock(blocks.StructBlock):
if Segment.objects.count() > 0:
segment = blocks.ChoiceBlock(choices=[
(segment.pk, "{} ({})".format(segment.name, segment.status) ) \
for segment in Segment.objects.all()
], required=False, label="Personalisation segment",
help_text="Only show this content block for users in this segment")