mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +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:
@@ -1,6 +1,6 @@
|
||||
{% extends "admin/base_site.html" %}
|
||||
{% load i18n %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">Home</a> › Documentation</div>{% endblock %}
|
||||
{% block breadcrumbs %}<div class="breadcrumbs"><a href="{{ root_path }}">Home</a> › Documentation</div>{% endblock %}
|
||||
{% block title %}Documentation{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
@@ -22,11 +22,14 @@ class GenericSite(object):
|
||||
name = 'my site'
|
||||
|
||||
def get_root_path():
|
||||
from django.contrib import admin
|
||||
try:
|
||||
return urlresolvers.reverse(admin.site.root, args=[''])
|
||||
return urlresolvers.reverse('admin:index')
|
||||
except urlresolvers.NoReverseMatch:
|
||||
return getattr(settings, "ADMIN_SITE_ROOT_URL", "/admin/")
|
||||
from django.contrib import admin
|
||||
try:
|
||||
return urlresolvers.reverse(admin.site.root, args=[''])
|
||||
except urlresolvers.NoReverseMatch:
|
||||
return getattr(settings, "ADMIN_SITE_ROOT_URL", "/admin/")
|
||||
|
||||
def doc_index(request):
|
||||
if not utils.docutils_is_available:
|
||||
@@ -179,7 +182,7 @@ model_index = staff_member_required(model_index)
|
||||
def model_detail(request, app_label, model_name):
|
||||
if not utils.docutils_is_available:
|
||||
return missing_docutils_page(request)
|
||||
|
||||
|
||||
# Get the model class.
|
||||
try:
|
||||
app_mod = models.get_app(app_label)
|
||||
|
||||
Reference in New Issue
Block a user