📜  django 获取所有模型 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:57.368000             🧑  作者: Mango

代码示例2
import django.apps
django.apps.apps.get_models()  #uses django lib to show models in your Django App

#Sample Output:
[django.contrib.admin.models.LogEntry,
 django.contrib.auth.models.Permission,
 django.contrib.auth.models.Group,
 django.contrib.auth.models.User,
 django.contrib.contenttypes.models.ContentType,
 django.contrib.sessions.models.Session,
 myApp.models.myModel]