OK I know the title sounds really confusing, but really it’s quite simple. Consider this:
class A(models.Model):
field = models.CharField(max_length=10)
class B(models.Model):
field = models.CharField(max_length=10)
a_elements = models.ManyToManyField(A)
class C(models.Model):
field = models.CharField(max_length=10)
b_element = models.ForeignKey(A)
so, now what I want is to extend all instances of A with some other field. for example for every instance of A that is available via B i need an integer associated to it.
is there an easy way of doing this?
EDIT:
I think one can see this as a definition of one-to-many relationship from C to instances of A in B, if that makes sense…
If you need to extend all instances of A with another field, add another field.
For your example scenario of needing a field for every A through B, use a through model.
http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-on-many-to-many-relationships
By your question title, I think you’re asking a question about C though (which you didn’t mention)