On 5/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Hi, > > Is there a way to refine an autoreference field like : > > class Categorie(models.Model): > parent = models.ForeignKey(Categorie) > title = models.TextField()
What you are looking for is: class Categorie(models.Model): parent = models.ForeignKey('self') You can use the string 'self' to refer to a model that is in the process of being defined. 'self' can be used in ForeignKey or ManyToManyField definitions. The Model API docs have more details. You can also use the string version of a model name in place of the model itself. However, be warned that there are at least two known bugs (#1661,#1662) regarding the use of model name strings - until these are resolved, YMMV. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---