Beispiel #1
0
class PageLayout(models.Model):
    """
    A ``PageLayout`` object defines a template that can be used by a page.
    """
    # TODO: this should become optional, either allow Database templates, or a hard-coded list in settings.py

    key = models.SlugField(
        _('key'),
        help_text=_("A short name to identify the layout programmatically"))
    title = models.CharField(_('title'), max_length=255)
    template_path = TemplateFilePathField(
        'template file', path=appsettings.FLUENT_PAGES_TEMPLATE_DIR)

    #no children
    #unique
    #allowed_children

    def get_template(self):
        """
        Return the template to render this layout.
        """
        from django.template.loader import get_template
        return get_template(self.template_path)

    # Django stuff
    def __str__(self):
        return self.title

    class Meta:
        app_label = 'fluent_pages'
        ordering = ('title', )
        verbose_name = _('Layout')
        verbose_name_plural = _('Layouts')
Beispiel #2
0
class PageLayout(models.Model):
    """
    A ```PageLayout``` object defines a layout of a page; which content blocks are available.
    """

    key = models.SlugField(
        _('key'),
        help_text=_("A short name to identify the layout programmatically"))
    title = models.CharField(_('title'), max_length=255)
    template_path = TemplateFilePathField(
        'template file', path=appsettings.FLUENT_PAGES_TEMPLATE_DIR)

    #regions = a RelatedManager
    #no children
    #unique
    #allowed_children

    def get_template(self):
        """
        Return the template to render this layout.
        """
        from django.template.loader import get_template
        return get_template(self.template_path)

    # Django stuff
    def __unicode__(self):
        return self.title

    class Meta:
        app_label = 'fluent_pages'
        ordering = ('title', )
        verbose_name = _('Layout')
        verbose_name_plural = _('Layouts')