Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is ManyToManyField(through='ThroughModel') supported? #36

Open
mnieber opened this issue Jun 30, 2021 · 2 comments
Open

Is ManyToManyField(through='ThroughModel') supported? #36

mnieber opened this issue Jun 30, 2021 · 2 comments

Comments

@mnieber
Copy link

mnieber commented Jun 30, 2021

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:

Selection_169

Is ManyToManyField with the through keyword supported?

django==3.2.3
django-spaghetti-and-meatballs==0.4.2
@LegoStormtroopr
Copy link
Owner

LegoStormtroopr commented Jun 30, 2021

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

image

@mnieber
Copy link
Author

mnieber commented Jul 1, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants