Trying to get a better handle on how django database relationships are handled. Any thoughts are appreciated.
Considering the following example models:
class Things(models.Model):
name = models.CharField(max_length=20)
class Stuff(models.Model):
name = models.CharField(max_length=20)
information = models.ManyToManyField('Information')
things = models.ForeignKey('Things')
class Information(models.Model):
name = models.CharField(max_length=20)
stuff = models.ForeignKey('Stuff')
An error results from syncdb
: AttributeError: 'ManyToManyField' object has no attribute 'ForeignKey'
. The error results if I include both the ManyToManyField
and the Foreign Key
fields in the Stuff
model.
Is there a way that I can make both of these relationships exist? Thanks for any ideas.