diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index d435675eae..ad7f7d405c 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -470,21 +470,11 @@ class ModelAdmin(BaseModelAdmin): info = self.model._meta.app_label, self.model._meta.model_name urlpatterns = patterns('', - url(r'^$', - wrap(self.changelist_view), - name='%s_%s_changelist' % info), - url(r'^add/$', - wrap(self.add_view), - name='%s_%s_add' % info), - url(r'^(.+)/history/$', - wrap(self.history_view), - name='%s_%s_history' % info), - url(r'^(.+)/delete/$', - wrap(self.delete_view), - name='%s_%s_delete' % info), - url(r'^(.+)/$', - wrap(self.change_view), - name='%s_%s_change' % info), + url(r'^$', wrap(self.changelist_view), name='%s_%s_changelist' % info), + url(r'^add/$', wrap(self.add_view), name='%s_%s_add' % info), + url(r'^(.+)/history/$', wrap(self.history_view), name='%s_%s_history' % info), + url(r'^(.+)/delete/$', wrap(self.delete_view), name='%s_%s_delete' % info), + url(r'^(.+)/$', wrap(self.change_view), name='%s_%s_change' % info), ) return urlpatterns diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 8abf49331b..91b805e513 100644 --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -190,8 +190,7 @@ class AdminSite(object): if LOGIN_FORM_KEY in request.POST and request.user.is_authenticated(): auth_logout(request) if not self.has_permission(request): - if request.path == reverse('admin:logout', - current_app=self.name): + if request.path == reverse('admin:logout', current_app=self.name): index_path = reverse('admin:index', current_app=self.name) return HttpResponseRedirect(index_path) return self.login(request) @@ -217,34 +216,19 @@ class AdminSite(object): # Admin-site-wide views. urlpatterns = patterns('', - url(r'^$', - wrap(self.index), - name='index'), - url(r'^logout/$', - wrap(self.logout), - name='logout'), - url(r'^password_change/$', - wrap(self.password_change, cacheable=True), - name='password_change'), - url(r'^password_change/done/$', - wrap(self.password_change_done, cacheable=True), - name='password_change_done'), - url(r'^jsi18n/$', - wrap(self.i18n_javascript, cacheable=True), - name='jsi18n'), - url(r'^r/(?P\d+)/(?P.+)/$', - wrap(contenttype_views.shortcut), - name='view_on_site'), - url(r'^(?P\w+)/$', - wrap(self.app_index), - name='app_list') + url(r'^$', wrap(self.index), name='index'), + url(r'^logout/$', wrap(self.logout), name='logout'), + url(r'^password_change/$', wrap(self.password_change, cacheable=True), name='password_change'), + url(r'^password_change/done/$', wrap(self.password_change_done, cacheable=True), name='password_change_done'), + url(r'^jsi18n/$', wrap(self.i18n_javascript, cacheable=True), name='jsi18n'), + url(r'^r/(?P\d+)/(?P.+)/$', wrap(contenttype_views.shortcut), name='view_on_site'), + url(r'^(?P\w+)/$', wrap(self.app_index), name='app_list'), ) # Add in each model's views. for model, model_admin in six.iteritems(self._registry): urlpatterns += patterns('', - url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), - include(model_admin.urls)) + url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls)) ) return urlpatterns