On 28 oct, 08:54, Daniel Strasser <[EMAIL PROTECTED]> wrote: > Hi Daniel > > > This is why it's a bad idea to do from x import *. You should always > > import the things you need explicitly, then you can tell what's going > > wrong. Try doing > > from schoolutil.lesson.models import Lesson > > and see if it still goes wrong - or if you get a more informative > > error message. > > Thanks for your tip. I've done this, now I'm getting the following > error when I try to start the built-in development server: > > [EMAIL PROTECTED]:~/work/schoolutil$ python manage.py runserver > Validating models... > could not import in lesson.models (snip) > File "/home/daniel/work/schoolutils/../schoolutils/student/ > models.py", line 3, in <module> > from schoolutils.lesson.models import Lesson > File "/home/daniel/work/schoolutils/lesson/models.py", line 7, in > <module> > class Lesson(models.Model): > File "/home/daniel/work/schoolutils/lesson/models.py", line 8, in > Lesson > student = models.ForeignKey(Student) > NameError: name 'Student' is not defined
You have a circular reference between students.models and lessons.models. The first want to import the second, which want to import the first, etc... This just can't work. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---