Django 1.8:如何在不同的应用程序中使用模型作为多对多关系中的“通过”? [英] Django 1.8: How do I use a model in a different app as a 'through' in a Many to Many relationship?

查看:116
本文介绍了Django 1.8:如何在不同的应用程序中使用模型作为多对多关系中的“通过”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档仅显示使用多对多/中间模型,其中模型位于同一应用程序中。如何在不同的应用程序中使用中介表?我不认为应用程序导入中介的的作品,因为通过属性在撇号中声明。

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.

推荐答案

答案:使用'app.model'。我不认为这在上下文中会起作用,但是它确实

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

这篇关于Django 1.8:如何在不同的应用程序中使用模型作为多对多关系中的“通过”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆