我无法将新模型添加到django的管理网站。只有一个应用程序可以显示其模型,其他应用程序无法将其模型添加到管理站点。
这是我的settings.py:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'Home',
'Scope',
'Trend',
'Log',
'Lab',
'Club',
'Article',
'Search',
'page_test',
这是urls.py:
from django.conf.urls import patterns, include, url
from cretus import views
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'cretus.views.home', name='home'),
# url(r'^cretus/', include('cretus.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
#url(r'^$', include('Home.urls')),
url(r'^$', include('page_test.urls')),
url(r'^page/', include('Home.urls')),
url(r'^search/', include('Search.urls')),
url(r'^test/', include('page_test.urls')),
#url(r'artistsearch/', include('Search.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^artscopes/', include('Scope.urls')),
url(r'^trend/', include('Trend.urls')),
url(r'^log/', include('Log.urls')),
url(r'^lab/', include('Lab.urls')),
url(r'^club/', include('Club.urls')),
url(r'^privacy/$', views.privacy, name='privacy'),
url(r'thanks/$', views.thanks, name='thanks'),
url(r'^contest/$', views.contestForm, name='contest'),
url(r'^terms/$', views.terms, name='terms'),
#url(r'^test/$', views.test, name='test'),
#url(r'^(?P<title>[a-zA-Z0-9_-]{0,100})/$', views.getArticleByTitle, name='test'),
#url(r'^article/', include('Article.urls')),
url(r'^article/', include('page_test.urls')),
# Apps
url(r'^tinymce/', include('tinymce.urls')),
url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^sitemap.xml$', views.sitemap, name='sitemap'),
url(r'^googlesearch/$', views.googlesearch, name='googlesearch'),
url(r'^legal/$', views.legal, name='legal'),
url(r'^', views.error, name='error'),
)
这是admin.py之一:
from django.contrib import admin
from Lab.models import AttendeeInfo
class AttendeeInfoAdmin(admin.ModelAdmin):
list_display = ('fname', 'lname', 'email', 'video_url', 'package_name')
admin.site.register(AttendeeInfo, AttendeeInfoAdmin)
答案 0 :(得分:0)
这个问题已经解决了。这是因为尚未授予该用户权限。因此,下次当您发现已完成所有操作但仍无法在管理控制台中找到您的模型时,您可能需要检查此用户的权限。