django-spaghetti-and-meatballs
django-spaghetti-and-meatballs copied to clipboard
Is ManyToManyField(through='ThroughModel') supported?
I'm trying django spaghetti with these models
class Organization(Entity):
name = models.CharField(max_length=100)
class Program(Entity):
name = models.CharField(max_length=100)
members = models.ManyToManyField(Organization, through="ProgramMember")
class ProgramMember(Entity):
organization = models.ForeignKey(Organization, on_delete=models.CASCADE)
program = models.ForeignKey(Program, on_delete=models.CASCADE)
I was expecting a diagram with Organization
on the left, Program
on the right, and ProgramMember
in the middle connecting the two, but instead I got this:
Is ManyToManyField with the through
keyword supported?
django==3.2.3
django-spaghetti-and-meatballs==0.4.2
I don't think we have support for through
models yet, but it shouldn't be hard.
If you look at the image, you can see there are two arrows in the red circle - And I'd guess that its drawn the connections over one another, because from a raw fields perspective, its drawing:
Program Member -> Organisation
Program Member -> Program
Yes, there is something strange about how the lines are drawn. The blue line is drawn on top of the grey arrowheads. I think that from a raw fields perspective it's drawing
Program Member -> Organisation
Program Member -> Program
Organisation -> Program
Program -> Organisation