diff --git a/src/personalisation/blocks.py b/src/personalisation/blocks.py new file mode 100644 index 0000000..105fa08 --- /dev/null +++ b/src/personalisation/blocks.py @@ -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") +