我不知道我做錯了什麼,但我不能將模型添加到我的管理員。Django:將模型添加到管理站點
settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'RM.cal',
'release',
'south',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.gzip.GZipMiddleware',
'django_notify.middleware.NotificationsMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
global_settings.TEMPLATE_CONTEXT_PROCESSORS +
('django.core.context_processors.request','django.contrib.messages.context_processors.messages',)
)
admin.py
from cal.models import *
from django.contrib import admin
admin.site.register(Cos)
urls.py
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^RM/', include('RM.foo.urls')),
(r'^cal/', include('RM.cal.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': 'C:/Users/sg0217297/Desktop/test/tkt_crmt/RM/media'}),
的models.py其新的領域只是用於測試,但我可以把它添加到管理員;/
from django.db import models
from django.contrib import admin
class Cos(models.Model):
name = models.CharField(max_length=400, blank= False , null = True)
def __unicode__(self):
return self.name
任何想法,爲什麼?
感謝您的幫助
E: 更新urls.py
當您運行syncdb時它能正常工作嗎?除了缺失的模型之外,管理網站還可以顯示嗎? – Ctrlspc
你在這裏展示的是哪個urls.py? '模式('RM.cal.views'...'似乎不適合管理網址。 – Rohan
Im使用南遷移我不能創建新的數據庫。是在管理站點我看到其他模型,但這一個(不知道爲什麼)我沒有看到... – Silwest