Django 1.8: How do I use a model in a different app as a 'through' in a Many to Many relationship?

南笙酒味 提交于 2020-01-17 08:26:51

问题


The docs only show using a many-to-many-through/intermediary model where the model is in the same app. How can I do this with the intermediary table in a different app? I don't think from app import intermediary works, as the through attribute is declared within apostrophes.


回答1:


Answer: Use 'app.model'. I didn't think it would work in this context, but it does



来源:https://stackoverflow.com/questions/31746235/django-1-8-how-do-i-use-a-model-in-a-different-app-as-a-through-in-a-many-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!