Charles Smith
Charles Smith

Reputation: 3289

Insert Django Wagtail Settings into Template

I'm having what is surely to be user-error, a problem with populating my template with custom model that I've created and herited from BaseSetting. I can login to admin and can view the custom settings I've created; getting the data to show in my template is another thing.

Here is my BaseSetting

@register_setting
class SiteSettings(BaseSetting):
    ...
    company_name = models.CharField(blank=True, max_length=250, help_text='Enter your company name how you would like it to appear on the site')

    panels = [
        ...
        MultiFieldPanel(
            [
                FieldPanel('company_name'),
            ],
            heading="Company Info",
            classname="collapsible collapsed"
        ),
    ]

I've added 'wagtail.contrib.settings', to my installed apps, add the context_processors per the docs and with my template settings set to

{% load wagtailsettings_tags %}
{% get_settings %}
{{ settings.app_label.SiteSettings.company_name }}

I still get nothing. Any help would be greatly appreciated. Thank you.

Upvotes: 1

Views: 815

Answers (1)

Serafeim
Serafeim

Reputation: 15084

Try replacing app_label in {{ settings.app_label.SiteSettings.company_name }} with the actual name of your application as per http://docs.wagtail.io/en/v1.5.2/reference/contrib/settings.html#using-in-django-templates.

Upvotes: 3

Related Questions