mirror of
https://github.com/django/django.git
synced 2025-08-01 09:32:50 +00:00
Fixed #10061 -- Added namespacing for named URLs - most importantly, for the admin site, where the absence of this facility was causing problems. Thanks to the many people who contributed to and helped review this patch.
This change is backwards incompatible for anyone that is using the named URLs introduced in [9739]. Any usage of the old admin_XXX names need to be modified to use the new namespaced format; in many cases this will be as simple as a search & replace for "admin_" -> "admin:". See the docs for more details on the new URL names, and the namespace resolution strategy. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11250 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9fd19c0161
commit
8d48eaa064
20 changed files with 544 additions and 119 deletions
|
@ -10,19 +10,19 @@ import models
|
|||
class Admin2(admin.AdminSite):
|
||||
login_template = 'custom_admin/login.html'
|
||||
index_template = 'custom_admin/index.html'
|
||||
|
||||
|
||||
# A custom index view.
|
||||
def index(self, request, extra_context=None):
|
||||
return super(Admin2, self).index(request, {'foo': '*bar*'})
|
||||
|
||||
|
||||
def get_urls(self):
|
||||
return patterns('',
|
||||
(r'^my_view/$', self.admin_view(self.my_view)),
|
||||
) + super(Admin2, self).get_urls()
|
||||
|
||||
|
||||
def my_view(self, request):
|
||||
return HttpResponse("Django is a magical pony!")
|
||||
|
||||
|
||||
site = Admin2(name="admin2")
|
||||
|
||||
site.register(models.Article, models.ArticleAdmin)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue