我正在Djano中创建一个多用户博客,并希望为所有用户使用Admin
视图来提供创建,编辑和删除帖子的功能。
我找到了this教程,该教程解释了管理员对非员工用户的使用。但是,我收到了错误
cannot import name user_admin_site
admin.py
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
class UserAdmin(AdminSite):
pass
user_admin_site = UserAdmin(name='user')
urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from myapp.admin import user_admin_site
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include(user_admin_site.urls)),
url(r'^', include('myapp.urls')),
)