我想在我的 Django 管理面板中重新排序我的应用程序,我在 SO 中看到了另一个类似问题的一些回复,所以我去安装这个方法:django-modeladmin-reorder
我按照所有步骤操作,但它不起作用。这是我实际的 Django 面板
#settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
# Disable Django's own staticfiles handling in favour of WhiteNoise, for
# greater consistency between gunicorn and `./manage.py runserver`. See:
# http://whitenoise.evans.io/en/stable/django.html#using-whitenoise-in-development
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
'admin_reorder',
'organization_owners',
'panel',
'clients',
]
MIDDLEWARE_CLASSES = (
'admin_reorder.middleware.ModelAdminReorder',
)
ADMIN_REORDER = (
# Keep original label and models
'organization_owners',
'panel',
'clients',
)
也在我的requirements.txt中
Django==2.0.1
django-extensions==1.9.8
django-modeladmin-reorder==0.2
djangorestframework==3.7.7
flake8==3.5.0
最佳答案
我检查了他们的 github repo它在两个月前更新以支持 Django 2.0 但它是 Python Package Index version 0.2最后上传于 2016-09-08。
所以有可能pip安装还是安装了不支持Django 2.0的版本
请注意,urlresolvers 模块已在 Django 1.10 中弃用并在 2.0 中删除(django-modeladmin-reorder 仍然依赖于 urlresolvers)
你可以做什么:
如果您已经了解 Django==1.8,请先尝试 django-modeladmin-reorder。
在您的项目中使用他们在 GitHub 上的代码。这是最新提交的链接。 https://github.com/mishbahr/django-modeladmin-reorder/commit/f21929480c398c2628291d74af2f319421f651f3
关于python - 在 Django 管理中重新排序应用程序和模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48293930/