On 15/07/2013 1:02am, Charounson Saintilus wrote:
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')

If you want to relate Course to Course then you need to use 'self' instead of Course in the prereq field

https://docs.djangoproject.com/en/1.5/ref/models/fields/#django.db.models.ManyToManyField.symmetrical



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+unsubscr...@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.



--
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+unsubscr...@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.


Reply via email to