I'd like to have automatic relation binding between two different m2m fields. Here is an example of my desired workflow:
- create a Tag "Green"
- create a Tag "Colors" and mark "Green" as a child
- now, when I go back to "Green" tag panel it needs to have "Colors" among parents
Unfortunately it's not that simple and I can't come up with anything. I tried setting symmetrical to True but it's just making unnecessary loop ("Green" is not a parent to "Colors"!)
# my models.py
class Tag(models.Model):
...
children = models.ManyToManyField(
'self',
blank=True,
related_name="kids",
symmetrical=False
)
parents = models.ManyToManyField(
'self',
blank=True,
related_name="folks",
symmetrical=False
)
Thanks for help.