Actually, the Django term for this is "through". Not via.

See 
https://docs.djangoproject.com/en/1.6/topics/db/models/#extra-fields-on-many-to-many-relationships
 
on how to specify the intermediate table to be used in many-to-many 
relationships.


Den lördagen den 15:e mars 2014 kl. 18:01:02 UTC+1 skrev Dennis Lee Bieber:
>
> On Sat, 15 Mar 2014 08:38:03 -0700 (PDT), willy Hakizimana 
> <will...@gmail.com <javascript:>> declaimed the following: 
>
> >First of all, this community is amazing at how fast questions are 
> answered. 
> >I have learned so much. 
> > 
> > 
> >I am designing an app with models that look like this. 
> > 
> >Country(country_id(PK), country_name, gdp, gdp_growth, income_per_capita) 
> > 
> >Product(product_id(PK), product_name, country_id(FK), imports_volume) 
> > 
> >Since I have to show imports_volume for the same product in each country, 
> I 
> >am stumped on how to design the db. 
> > 
>         If I understand your statement, you need (paraphrased) the 
> imports_volume to be for each product for each country... 
>
>         That means it does NOT belong in either Country or Product tables. 
>
> Country(*countryID*, Name, gdp, gdp_growth, per_capita_income) 
>
> Product(*productID*,  Name) 
>
> Imports(_countryID_, _productID_, import_volume) 
>
>         In Django terms (I believe), this is a many2many relationship 
> using a 
> via table (the native m2m would create a table with _countryID_, 
> _productID_ foreign keys only; the via table lets you add data specific to 
> the relationship itself... An intersect table in older database 
> terminology) 
>
> > 
> > 
> -- 
>         Wulfraed                 Dennis Lee Bieber         AF6VN 
>     wlf...@ix.netcom.com <javascript:>    HTTP://wlfraed.home.netcom.com/ 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9c0f640e-99e9-4d6d-9c89-067755b7f8de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to