I have a problem with the importation of wagtail.contrib.settings.models import ModelSettings

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

Вернуться на верх