我为管理模型创建了一个单独的文件 - 我如何让 django 在文件中查找?目前,课程未显示在管理员中。这是admin.py:
from django.contrib import admin
from website.apps.courses import Course
class CourseAdmin(admin.ModelAdmin):
list_display = ('title', 'start_date')
admin.site.register(Course, CourseAdmin)
这是 urls.py:
from django.contrib import admin
from django.conf.urls.defaults import patterns, include, url
from website.apps.courses.views import *
admin.autodiscover()
urlpatterns = patterns('',
# Admin panel and documentation:
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)