1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

newforms-admin: Made it easier to specify a custom template to be used in the admin section. You can now specify index_template and login_template properties on an AdminSite subclass, and change_form_template, change_list_template, object_history_template and delete_confirmation_template properties on a ModelAdmin subclass.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7630 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Simon Willison
2008-06-13 15:42:43 +00:00
parent f33bdf7e9c
commit 725293d51a
10 changed files with 131 additions and 34 deletions

View File

@@ -1,7 +1,6 @@
from django.db import models
from django.contrib import admin
class Article(models.Model):
"""
A simple article to test admin views. Test backwards compabilty.
@@ -24,6 +23,14 @@ class CustomArticle(models.Model):
date = models.DateTimeField()
class CustomArticleAdmin(admin.ModelAdmin):
"""
Tests various hooks for using custom templates and contexts.
"""
change_list_template = 'custom_admin/change_list.html'
change_form_template = 'custom_admin/change_form.html'
object_history_template = 'custom_admin/object_history.html'
delete_confirmation_template = 'custom_admin/delete_confirmation.html'
def changelist_view(self, request):
"Test that extra_context works"
return super(CustomArticleAdmin, self).changelist_view(request, extra_context={