On Sat, Mar 28, 2009 at 10:55 AM, mahesh <forvai...@gmail.com> wrote:

>
> I am working on a (College) course manager project. Here is a
> situation where any course have 0 (Zero) or More Prerequisites, anyone
> who register for a course should satisfy dependency.
>
> <project>/course_modue/model.py hash this..
>
> Here how my model looks like ..
>
> class CourseRelation(models.Model):
>    course = models.CharField(max_length=64)
>    prereq = models.ManyToManyField(CourseRelation)
>    instructor = models.ForeignKey(User)
>    is_active = models.BooleanField(default=False)
>
> Command - python manage.py sqlall course_module error out saying
>  File "<path>/course_module/models.py", line 27, in CourseRelation
>    prereq = models.ManyToManyField(CourseRelation)
> NameError: name 'CourseRelation' is not defined
>
> Is this a case of forward referencing ? how do I solve it ?
>
> Thx/Mahesh.
>
>
> >
>
To do references to the same model you do ManyToManyField('self').

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to