oh, I found the answer: use ForeignKey('self') to a many-to-one ref to model self
please ignore my former post. >_< On 10月24日, 下午12时47分, Ken <xie.kenn...@gmail.com> wrote: > I want to create a parent-child like catalog system. > > from django.db import models > > class Catalog(models.Model): > username = models.EmailField() > name = models.CharField(max_length=64) > color = models.CharField(max_length=20) > state = models.IntegerField() > parentcatalog = models.ManyToOneRel(Catalog) > > but when syncdb i got: > File "/home/ken/sites/mysite/catalog/models.py", line 12, in Catalog > parentcatalog = models.ManyToOneRel(Catalog) > NameError: name 'Catalog' is not defined > > It seems like I cannot ref to a model which is not completely defined. > What should I do? -- 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.