neon-jungle / wagtailpolls

A plugin for adding polling capabilities to the wagtail CMS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initialization error

frague59 opened this issue · comments

With wagtailpolls 0.2.1, I'm unable to load the wagtailpolls application, due to a mismatch in method signature:

  • in wagtailpolls/widgets.py:17
def __init__(self, content_type=None, **kwargs):
        if 'snippet_type_name' in kwargs:
  • In wagtailpolls.edit_handlers.BasePollChooserPanel#widget_overrides
    @classmethod
    def widget_overrides(cls):
        return {cls.field_name: AdminPollChooser(model=cls.target_model())}

We can change the wagtailpolls.edit_handlers.BasePollChooserPanel#widget_overrides:

    @classmethod
    def widget_overrides(cls):
        # Changes the parameter passed from ``AdminPollChooser`` from ``model`` to ``content_type``
        model_meta = cls.target_model()._meta
        content_type = ContentType.objects.get(app_label=model_meta.app_label, model=model_meta.model_name)
        return {cls.field_name: AdminPollChooser(content_type=content_type)}

This quick fix repairs the system...

Thanks !