当我使用时,django admin
我可以在仪表板上获得管理入口吗?如上图所示,如何获得表管理入口?我正在使用 django 1.4 。谢谢你的时间。Groups
Users
Permission
编辑:
from django.contrib import admin
from django.contrib.auth.models import Permission, ContentType
class PermissionAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['name','codename']}),
]
list_display = ('name', 'codename')
class ContentTypeAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['app_label','model']}),
('More info', {'fields': ['name','codename'], 'classes': ['collapse']}),
]
list_display = ('app_label', 'model')
admin.site.register(Permission, PermissionAdmin)
admin.site.register(ContentType, ContentTypeAdmin)
编辑后,我得到了。
django.core.exceptions.ImproperlyConfigured: 'ContentTypeAdmin.fieldsets[1][2]['fields']' refers to field 'codename' that is missing from the form.
ContentType 可以onetomany
给 Permission。在admin中如何处理这两个模型?在我添加之前它工作正常:
('More info', {'fields': ['name','codename'], 'classes': ['collapse']}),
编辑2: