KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm really not getting this, so if someone could explain how this works I'd very much appreciate it. I have two applications, Accounts and Theme... here is my settings list: INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'accounts', 'themes', ) In accounts, I am trying to do this: from themes.models import Theme class Account(models.Model): ACTIVE_STATUS = 1 DEACTIVE_STATUS = 2 ARCHIVE_STATUS = 3 STATUS_CHOICES = ( (ACTIVE_STATUS, ('Active')), (DEACTIVE_STATUS, ('Deactive')), (ARCHIVE_STATUS, ('Archived')), ) id = models.AutoField(primary_key=True) name = models.CharField(max_length=250) slug = models.SlugField(unique=True, verbose_name='URL Slug') status = models.IntegerField(choices=STATUS_CHOICES, default=ACTIVE_STATUS, max_length=1) owner = models.ForeignKey(User) enable_comments = models.BooleanField(default=True) theme = models.ForeignKey(Theme) date_created = models.DateTimeField(default=datetime.now) And in my theme model: class Theme(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(max_length=250) slug = models.SlugField(unique=True, verbose_name='URL Slug') date_created = models.DateTimeField(default=datetime.now) class Stylesheet(models.Model): id = models.AutoField(primary_key=True) account = models.ForeignKey(Account) date_created = models.DateTimeField(default=datetime.now) content = models.TextField() Django is kicking out the following error: from themes.models import Theme ImportError: cannot import name Theme Is this some kind of circular import issue? I've tried using a lazy reference, but that doesn't seem to work either!
Tags (comma-separated)
Save Edits
Cancel