Sunday, July 14, 2013

Error with Passing a class name as a parameter in a ManyToManyField

This is my first time using the Django Web Framework and I'm new to the python language, so please bear with me.
I've created a model (i.e. a class) called Course which defines several variables:

class Course(models.Model):
        name = models.CharField(max_length=32)
                                   .
                                   .  
                                   .
                                   .
        prereq = models.ManyToManyField(Course, blank=True, null=True, through='PreReqToCourse')

When I try to serve the files from the local server with, python manage.py runserver, I get the following error:

...
...
prereq = models.ManyToManyField(Course, blank=True, null=True, through='PreReqToCourse')
NameError: name 'Course' is not defined


Any ideas? 

Thanks in advance! 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate