That was it :)
Thanks a lot
On Jun 26, 4:15 pm, Horst Gutmann <[EMAIL PROTECTED]> wrote:
> Christopher wrote:
> > Hi,
>
> > I am pretty new to both Python and Django and have a quick and
> > hopefully easy question. Is it possible to create a Model with a link
> > back onto itself?
>
> > Check the code below which does not seem to work.
>
> > class Menu(models.Model):
> > display_text = models.CharField(maxlength=50)
> > url = models.URLField(verify_exists=False)
> > parent_menu_item = models.ForeignKey(Menu)
>
> > I get the following error when I try to manage.py syncdb
>
> > Error: Couldn't install apps, because there were errors in one or more
> > models:
> > totalimpact.menu: name 'Menu' is not defined
>
> Try something like this: models.ForeignKey("self") :-)
>
> There are some examples for this available with many-to-one
> relationships [1]
>
> [1]http://www.djangoproject.com/documentation/models/m2o_recursive/
>
> - Horst
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---