嗨,一个模型有可能有一个包含所有可用应用程序的多域作为它的选择吗
假设我在我的settings.py中安装了这些应用程序
在我的模型里,我有这个模型
class IPAddreses(models.Model):
ip = models.GenericIPAddressField()
apps = models.ManyToManyField(ContentType, blank=True)
# The apps field should be the choices of the avialable apps on the settings.py
有可能吗
可能不可能,但您可以做的只是使用已安装应用程序的列表更新一个新模型/表,并向该模型添加多对多关系。 这将是一个更简单、更灵活的解决方案。 因为您可以跟踪(如果需要)与从已安装应用列表中删除的应用的关系
可能的解决方案:
其他选项:
App
模型并使用应用程序的^{ArrayField(CharField)
(Postgresql only)李>相关问题 更多 >
编程相关推荐