How can I create custom page for django admin?

后端 未结 5 1556
日久生厌
日久生厌 2020-12-13 02:28

I want to create custom page for admin panel without model. For first i copy index.html to project folder:

mysite/
    templates/
        admin/
                     


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 03:14

    You need to add your admin URL before the URL patterns of the admin itself:

    urlpatterns = patterns('',
       url(r'^admin/preferences/$', TemplateView.as_view(template_name='admin/preferences/preferences.html')),
       url(r'^admin/', include('django.contrib.admin.urls')),
    )
    

    This way the URL won't be processed by Django's admin.

提交回复
热议问题