Reputation: 203
I started to build startup project using Django and Wagtail, but I have one problem, snippets don't migrate.
limbro/
config/
website/
this is a base project structure.
PS D:\Documents\GitHub\limbro.io> python manage.py makemigrations No changes detected PS D:\Documents\GitHub\limbro.io>
snippets.py file in website
from django.db import models
from wagtail.snippets.models import register_snippet
from wagtail.admin.edit_handlers import FieldPanel
@register_snippet
class Footer(models.Model):
facebook_page = models.URLField(blank=True)
instagram_page = models.URLField(blank=True)
panels = [
FieldPanel('facebook_page'),
FieldPanel('instagram_page'),
]
def __str__(self):
return "Footer"
class Meta:
verbose_name = "Footer"
verbose_name_plural = "Footer"
Upvotes: 1
Views: 199
Reputation: 25292
The Django migration framework specifically looks for a module called models
within your app - if your models are defined in snippets.py
, it won't find them. One way to fix this is to add an import
line to models.py
:
from .snippets import Footer
Upvotes: 2