Hey, I've been following the tutorial on Custom user models with wagtail and i want to implement it in one of my projects. However when i follow the example and attempt it i keep getting a "CircularDependencyError" message. How can i resolve the problem?
The code for the model i'm using is shown below:
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import AbstractUser
from wagtail.wagtailadmin.edit_handlers import FieldPanel
from wagtail.wagtailsnippets.models import register_snippet
from wagtail.wagtailimages.edit_handlers import ImageChooserPanel
@register_snippet
class County(models.Model):
name = models.CharField(max_length=100, null=True, blank=True)
# file = models.ImageField(upload_to='CountyLogos/%Y/%m/%d/', null=True)
file = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+',
)
date = models.DateTimeField(auto_now_add=True)
active = models.BooleanField(default=True)
panels = [
FieldPanel('name'),
ImageChooserPanel('file'),
FieldPanel('active'),
]
class Meta:
verbose_name_plural = 'Counties'
def __unicode__(self):
return
self.nameclass CountyOfficial(AbstractUser):
county = models.ForeignKey(
County,
on_delete=models.SET_NULL,
null=True)
The error i keep getting when i run the makemigration command is:
File "/home/vincent/.virtualenvs/jrs/local/lib/python2.7/site-packages/django/db/migrations/graph.py", line 241, in ensure_not_cyclic
raise CircularDependencyError(", ".join("%s.%s" % n for n in cycle))
django.db.migrations.exceptions.CircularDependencyError: wagtailcore.0001_squashed_0016_change_page_url_path_to_text_field, map.0001_initial, wagtailimages.0013_make_rendition_upload_callable, wagtailimages.0012_copy_image_permissions_to_collections, wagtailcore.0026_group_collection_permission, wagtailcore.0025_collection_initial_data, wagtailcore.0024_collection, wagtailcore.0023_alter_page_revision_on_delete_behaviour, wagtailcore.0022_add_site_name, wagtailcore.0021_capitalizeverbose, wagtailcore.0020_add_index_on_page_first_published_at, wagtailcore.0019_verbose_names_cleanup, wagtailcore.0018_pagerevision_submitted_for_moderation_index, wagtailcore.0017_change_edit_page_permission_description