# coding: utf-8
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django import forms
from django.utils.translation import ugettext_lazy as _

from djangocms_baseplugins.baseplugin import defaults
from djangocms_baseplugins.baseplugin.cms_plugins import BasePluginMixin
from djangocms_baseplugins.baseplugin.utils import get_fields_from_fieldsets, get_baseplugin_widgets
from . import conf
from .models import Spacer


class SpacerPluginForm(forms.ModelForm):
    class Meta:
        model = Spacer
        fields = get_fields_from_fieldsets(conf.FIELDSETS)
        # exclude = []
        widgets = get_baseplugin_widgets(conf)


class SpacerPlugin(BasePluginMixin, CMSPluginBase):
    model = Spacer
    form = SpacerPluginForm
    module = defaults.SPECIAL_LABEL
    name = _(u'Spacer')
    render_template = "djangocms_baseplugins/spacer.html"
    fieldsets = conf.FIELDSETS


plugin_pool.register_plugin(SpacerPlugin)

[(31, 'cms.plugin_pool.plugin_pool.register_plugin', 'plugin_pool.register_plugin', False, 'from cms.plugin_pool import plugin_pool\n'), (26, 'django.utils.translation.ugettext_lazy', '_', True, 'from django.utils.translation import ugettext_lazy as _\n'), (17, 'djangocms_baseplugins.baseplugin.utils.get_fields_from_fieldsets', 'get_fields_from_fieldsets', False, 'from djangocms_baseplugins.baseplugin.utils import get_fields_from_fieldsets, get_baseplugin_widgets\n'), (19, 'djangocms_baseplugins.baseplugin.utils.get_baseplugin_widgets', 'get_baseplugin_widgets', False, 'from djangocms_baseplugins.baseplugin.utils import get_fields_from_fieldsets, get_baseplugin_widgets\n')]