Dougoc / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

graph_models dhowing extra relationtionship when using through option #76

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use the ManyToManyField with a through argument
2. Generated graph shows a many-to-many relationship along with the bridge
table relationship.

What is the expected output? What do you see instead?

The graph should not have the many-to-many relationship shown, but it does.

What version of the product are you using? On what operating system?

current trunk... 0.4 pre

Please provide any additional information below.

I've created a patch file that I believe will fix it by checking the
field's creates_table attribute. Not sure what it will do on older versions
of django.

Original issue reported on code.google.com by Zoram...@gmail.com on 31 Dec 2008 at 3:00

Attachments:

GoogleCodeExporter commented 9 years ago
What would the expected output be if you define custom fields in the 
many-to-many
through model ?

As per example at:
http://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany

Seems to me that in that case (the most common use-case for the 'through' 
option?)
you would want to see this model. As it defined fields you would otherwise miss 
?

Original comment by v.oostv...@gmail.com on 9 Jan 2009 at 12:57

GoogleCodeExporter commented 9 years ago
> I've created a patch file that I believe will fix it by checking the
> field's creates_table attribute. Not sure what it will do on older versions
> of django.

With older versions you mean versions of django that does not have the
'fields.create_table' attribute ?

If so you could solve that by using: getattr(field, 'create_table', False)

Original comment by v.oostv...@gmail.com on 9 Jan 2009 at 12:58

GoogleCodeExporter commented 9 years ago
Thanks for pointing out the getattr... I'm still really new to python and 
django so I
didn't realize you could do that.

I've attached a really crude example of what I was talking about... I'd just 
take a
screenshot but am not on a computer where that would be possible.

The basic idea is that you want to see the table that it is going through with 
the
one-to-many relationship that it has (which is already showing) what is 
undesired is
the fact that you still see the direct many-to-many connection even though you 
see
the connection through the bridge. Does that make sense? 

Original comment by Zoram...@gmail.com on 9 Jan 2009 at 3:40

Attachments:

GoogleCodeExporter commented 9 years ago
Aah I-see... I was thinking the other way around somehow.. the picture helps a 
lot :)

Yeah that direct relationship should not be there when drawing the 
through-table.
I've added your patch in svn, thanks for the report !! 

Original comment by v.oostv...@gmail.com on 10 Jan 2009 at 3:36

GoogleCodeExporter commented 9 years ago

Original comment by v.oostv...@gmail.com on 10 Jan 2009 at 3:44