Reputation: 13
from django.db import models
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.contrib.settings.models import ModelSettings,register_setting
@register_setting
class SocialMediaSettings(ModelSettings):
"""Social media settings for our custom website."""
facebook = models.URLField(blank=True, null=True, help_text="Facebook URL")
twitter = models.URLField(blank=True, null=True, help_text="Twitter URL")
youtube = models.URLField(blank=True, null=True, help_text="YouTube Channel URL")
panels = [
MultiFieldPanel([
FieldPanel("facebook"),
FieldPanel("twitter"),
FieldPanel("youtube"),
], heading="Social Media Settings")
]
I have already upgraded to the latest version of Wagtail but still encounter the error ImportError: cannot import name 'ModelSettings' from 'wagtail.contrib.settings.models
Upvotes: 0
Views: 26
Reputation: 25227
Wagtail does not provide a class named ModelSettings
. As per the documentation for the wagtail.contrib.setting
module, the two available base classes in wagtail.contrib.settings.models
are:
BaseGenericSetting
for generic settings across all sitesBaseSiteSetting
for site-specific settingsUpvotes: 0