mysql - Programmatically identify django many-to-many links -



mysql - Programmatically identify django many-to-many links -

i'd automatically generate list of objects many-to-many links.

let's have 5 models:

model 1 has m2m link model 2 model 2 has m2m link models 3 , 4 model 4 has m2m link model 5

if user adds object model 1, want give them alternative add together model 1 or add together model 2

if user adds object model 2, want give them alternative add together model 2, or add together model 1, 3, or 4.

if user adds object model 4, want give them alternative add together model 4 or model 5/2.

etc.

is there way observe these relationships (forward , backward) automatically?

you can access m2m relation fields via model1()._meta.many_to_many homecoming m2m relations, including genericrelations.

mysql django many-to-many

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -