Possible Duplicate:
Can I have a Django model that has a foreign key reference to itself?
I want to implement a simple folder-file like structure in my Django app. So I have a model for storing folders, but I also would like to store relation between this folder and parent folder. The simplified version of model would look like following:
class mFolder(models.Model):
name = models.CharField(max_length=50)
parentFolder = models.ForeignKey(mFolder, unique=False, related_name="childrenFolders")
However this is not possible, beacause mFolder is not declared yet.
Is there any simple solution for that problem?
Thanks for your help in advance.
Should be ‘self’: