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
Release history Release notifications | RSS feed
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.1.0.tar.gz
(6.3 kB
view details)
File details
Details for the file wagtailsettings-0.1.0.tar.gz
.
File metadata
- Download URL: wagtailsettings-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 477a534ef0a657323d835d07c36d5a0c662b08c8aadbab8efed719773e67c01f |
|
MD5 | e19302ff21e14ff506edbf669cceeaa1 |
|
BLAKE2b-256 | 9d928aebe7ff7ad0c36d1a0f637f0ca75891347fde3878c32492da93e10c28d6 |