Hi there,
Just starting to use django, so forgive me if this has been answered
before (a quick search at djanog-search did not turn up something
useful).
What I am trying to do is similar to this (from
http://www.djangoproject.com/documentation/models/m2m_recursive/):
<quote>
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')
</quote>
The difference is that I wanted to add additional information to the
link, so need a separate table. According to the documentation here
http://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany
this is done with the additional through argument, so I get:
idols = models.ManyToManyField('self', symmetrical=False,
related_name='stalkers' through="Relationship")
and then define
class Relationship(models.Model):
source = models.ForeignKey(Person, related_name="%
(class)s_related_source")
target = models.ForeignKey(Person, related_name="%
(class)s_related_target")
desc = models.CharField(max_length=20)
However, when I do this, I get a runtime error complaining about the
two foreign keys.
I wonder how to solve this problem?
Any help appreciated,
Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---