Opened 15 years ago
Last modified 15 years ago
#11738 closed
many2many recursive relationship do not work in DJ 1.1 - second problem — at Initial Version
Reported by: | simon_gray99 | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.1 |
Severity: | Keywords: | many2many recursive missing tables | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
According to the page at:
http://www.djangoproject.com/documentation/models/m2m_recursive/
All that is required to produce a recursive many2many is the following code:
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=20)
friends = models.ManyToManyField('self')
idols = models.ManyToManyField('self', symmetrical=False, related_name='stalkers')
def unicode(self):
return self.name
When I try this exact same code in my application,
I get an immediate complaint that the table 'persons_idols' does not exist.
If I CREATE this table manually then things are OK but the documentation state that DJ is supposed to handle creating this
table when the 'through' flag is NOT used... it doesn't!
Please advise