Skip to main content

Admin-editable settings for Wagtail projects

Project description

A plugin for Wagtail that provides add developer-defined settings to the admin.

Installing

Install using pip:

pip install wagtailsettings

It works with Wagtail 0.5 and upwards.

Add it to your INSTALLED_APPS:

INSTALLED_APPS += [
    'wagtailnews',
]

Using

Create a model that inherits from BaseSetting, and register it using the register_setting decorator:

from wagtailnews.models import BaseSetting, register_setting

@register_setting
class SocialMediaSettings(BaseSetting):
    facebook = models.URLField(
        help_text='Your Facebook page URL')
    instagram = models.CharField(
        max_length=255, help_text='Your Instagram username, without the @')
    trip_advisor = models.URLField(
        help_text='Your Trip Advisor page URL')
    youtube = models.URLField(
        help_text='Your YouTube channel or user account URL')

A ‘Settings’ link will appear in the Wagtail admin, with links to each of the settings models defined.

If access to a setting is required in the code, the BaseSetting.for_site method will retrieve the setting for the supplied site:

def view(request):
    social_media_settings = SocialMediaSettings.for_site(request.site)
    ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtailsettings-0.2.0.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file wagtailsettings-0.2.0.tar.gz.

File metadata

File hashes

Hashes for wagtailsettings-0.2.0.tar.gz
Algorithm Hash digest
SHA256 dfb8fe685be10ba6cd4cfbd32f11f7b8c0e42b78ee33b346d3617f6dd0ac2f38
MD5 8998b733acd23020210f516a6334867a
BLAKE2b-256 15a4b5f9f292fc6080f3558cda7eaee835f061ff3e5d7c046daf8ac5a30d3f6c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page