diff --git a/manage.py b/manage.py old mode 100644 new mode 100755 diff --git a/src/wagtail_personalisation/migrations/0009_auto_20170531_0428.py b/src/wagtail_personalisation/migrations/0009_auto_20170531_0428.py new file mode 100644 index 0000000..1f64e98 --- /dev/null +++ b/src/wagtail_personalisation/migrations/0009_auto_20170531_0428.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.1 on 2017-05-31 04:28 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtail_personalisation', '0008_devicerule'), + ] + + operations = [ + migrations.RemoveField( + model_name='personalisablepage', + name='canonical_page', + ), + migrations.RemoveField( + model_name='personalisablepage', + name='page_ptr', + ), + migrations.RemoveField( + model_name='personalisablepage', + name='segment', + ), + migrations.DeleteModel( + name='PersonalisablePage', + ), + ] diff --git a/src/wagtail_personalisation/models.py b/src/wagtail_personalisation/models.py index cdf871e..f42d6a0 100644 --- a/src/wagtail_personalisation/models.py +++ b/src/wagtail_personalisation/models.py @@ -10,7 +10,6 @@ from wagtail.utils.decorators import cached_classmethod from wagtail.wagtailadmin.edit_handlers import ( FieldPanel, FieldRowPanel, InlinePanel, MultiFieldPanel, ObjectList, PageChooserPanel, TabbedInterface) -from wagtail.wagtailcore.models import Page from wagtail_personalisation.forms import AdminPersonalisablePageForm from wagtail_personalisation.rules import AbstractBaseRule @@ -147,10 +146,6 @@ class AbstractPersonalisablePage(models.Model): return not self.canonical_page and self.has_variations -class PersonalisablePage(AbstractPersonalisablePage, Page): - """ """ - - @cached_classmethod def get_edit_handler(cls): """Add additional edit handlers to pages that are allowed to have @@ -172,4 +167,4 @@ def get_edit_handler(cls): return edit_handler.bind_to_model(cls) -PersonalisablePage.get_edit_handler = get_edit_handler +AbstractPersonalisablePage.get_edit_handler = get_edit_handler diff --git a/src/wagtail_personalisation/wagtail_hooks.py b/src/wagtail_personalisation/wagtail_hooks.py index 7443a42..5f7d996 100644 --- a/src/wagtail_personalisation/wagtail_hooks.py +++ b/src/wagtail_personalisation/wagtail_hooks.py @@ -128,7 +128,10 @@ def page_listing_variant_buttons(page, page_perms, is_parent=False): """ model = AbstractPersonalisablePage.get_model() - personalisable_page = model.objects.filter(pk=page.pk) + if model: + personalisable_page = model.objects.filter(pk=page.pk) + else: + personalisable_page = page segments = Segment.objects.all() if personalisable_page and len(segments) > 0 and not (