Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
wagtail_gardentronic / wagtail / core / blocks / static_block.py
Size: Mime:
from django.utils.translation import ugettext_lazy as _

from .base import Block

__all__ = ['StaticBlock']


class StaticBlock(Block):
    """
    A block that just 'exists' and has no fields.
    """
    def render_form(self, value, prefix='', errors=None):
        if self.meta.admin_text is None:
            if self.label:
                return _('{label}: this block has no options.').format(label=self.label)
            else:
                return _('This block has no options.')
        return self.meta.admin_text

    def value_from_datadict(self, data, files, prefix):
        return None

    class Meta:
        admin_text = None
        default = None