Hi Everyone,
I'm new to the Django community and I am having trouble with circular
imports. I've read every article that I can find about the issue
including posts on this group. I'm going to paste my model files and
the stack trace. I'm sure that this must be an issue that has come up
before. Thank you in advance for any help. If you know of an article
that explains the problem then point me to it. Thanks again.
------ Model A -----------
from django.db import models
from scinet.conferences.models import ConferenceAttendee
class Scientist(models.Model):
user = models.ForeignKey('auth.User')
summary = models.TextField()
undergrad = models.CharField(max_length=50)
graduate = models.CharField(max_length=50)
post_doctorate = models.CharField(max_length=50)
current_employer = models.CharField(max_length=50)
zipcode = models.CharField(max_length=5)
city = models.CharField(max_length=50)
state = models.CharField(max_length=2)
country = models.CharField(max_length=200, blank=False)
created = models.DateTimeField()
modified = models.DateTimeField()
conferences = models.ManyToManyField(Conference,
through='ConferenceAttendee')
------ Model B -----------
from django.db import models
from scinet.scientists.models import Scientist
class Conference(models.Model):
title = models.CharField(max_length=200)
description = models.TextField()
date = models.DateTimeField()
scientists = models.ManyToManyField(Scientist,
through='ConferenceAttendee')
created = models.DateTimeField()
modified = models.DateTimeField()
def __unicode__(self):
return self.name
class ConferenceAttendee(models.Model):
conference = models.ForeignKey(Conference)
scientist = models.ForeignKey(Scientist)
rsvp_date = models.DateTimeField()
presenter = models.BooleanField()
------ Stack Trace ------------
Validating models...
Unhandled exception in thread started by <function inner_run at
0x84f6aac>
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/management/
commands/runserver.py", line 48, in inner_run
self.validate(display_num_errors=True)
File "/usr/lib/python2.5/site-packages/django/core/management/
base.py", line 246, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.5/site-packages/django/core/management/
validation.py", line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 128, in get_app_errors
self._populate()
File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 57, in _populate
self.load_app(app_name, True)
File "/usr/lib/python2.5/site-packages/django/db/models/loading.py",
line 72, in load_app
mod = __import__(app_name, {}, {}, ['models'])
File "/home/guy/DjangoApps/scinet/../scinet/scientists/models.py",
line 2, in <module>
from scinet.conferences.models import ConferenceAttendee
File "/home/guy/DjangoApps/scinet/../scinet/conferences/models.py",
line 2, in <module>
from scinet.scientists.models import Scientist
ImportError: cannot import name Scientist
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---