嗨,有可能是模型有一個ManyToManyField與所有可用的應用程序作爲其選擇?Django多對多可用app_labels現場
比方說,我在我的settings.py在INSTALLED_APPS這些應用
然後在我的models.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
這可能嗎?
出於好奇,你的用例是什麼? – Udi
要啓用IPAddress白名單上的每個應用程序認證 –
另請參閱:https://docs.djangoproject.com/en/1.10/topics/auth/default/#programmatically-creating-permissions – Udi