mirror of https://github.com/django/django.git
Fixed awkward indentation in admin URLconfs
This commit is contained in:
parent
be983ee403
commit
273a1e6b8d
|
@ -470,21 +470,11 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
info = self.model._meta.app_label, self.model._meta.model_name
|
info = self.model._meta.app_label, self.model._meta.model_name
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^$',
|
url(r'^$', wrap(self.changelist_view), name='%s_%s_changelist' % info),
|
||||||
wrap(self.changelist_view),
|
url(r'^add/$', wrap(self.add_view), name='%s_%s_add' % info),
|
||||||
name='%s_%s_changelist' % info),
|
url(r'^(.+)/history/$', wrap(self.history_view), name='%s_%s_history' % info),
|
||||||
url(r'^add/$',
|
url(r'^(.+)/delete/$', wrap(self.delete_view), name='%s_%s_delete' % info),
|
||||||
wrap(self.add_view),
|
url(r'^(.+)/$', wrap(self.change_view), name='%s_%s_change' % info),
|
||||||
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
|
return urlpatterns
|
||||||
|
|
||||||
|
|
|
@ -190,8 +190,7 @@ class AdminSite(object):
|
||||||
if LOGIN_FORM_KEY in request.POST and request.user.is_authenticated():
|
if LOGIN_FORM_KEY in request.POST and request.user.is_authenticated():
|
||||||
auth_logout(request)
|
auth_logout(request)
|
||||||
if not self.has_permission(request):
|
if not self.has_permission(request):
|
||||||
if request.path == reverse('admin:logout',
|
if request.path == reverse('admin:logout', current_app=self.name):
|
||||||
current_app=self.name):
|
|
||||||
index_path = reverse('admin:index', current_app=self.name)
|
index_path = reverse('admin:index', current_app=self.name)
|
||||||
return HttpResponseRedirect(index_path)
|
return HttpResponseRedirect(index_path)
|
||||||
return self.login(request)
|
return self.login(request)
|
||||||
|
@ -217,34 +216,19 @@ class AdminSite(object):
|
||||||
|
|
||||||
# Admin-site-wide views.
|
# Admin-site-wide views.
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^$',
|
url(r'^$', wrap(self.index), name='index'),
|
||||||
wrap(self.index),
|
url(r'^logout/$', wrap(self.logout), name='logout'),
|
||||||
name='index'),
|
url(r'^password_change/$', wrap(self.password_change, cacheable=True), name='password_change'),
|
||||||
url(r'^logout/$',
|
url(r'^password_change/done/$', wrap(self.password_change_done, cacheable=True), name='password_change_done'),
|
||||||
wrap(self.logout),
|
url(r'^jsi18n/$', wrap(self.i18n_javascript, cacheable=True), name='jsi18n'),
|
||||||
name='logout'),
|
url(r'^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$', wrap(contenttype_views.shortcut), name='view_on_site'),
|
||||||
url(r'^password_change/$',
|
url(r'^(?P<app_label>\w+)/$', wrap(self.app_index), name='app_list'),
|
||||||
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<content_type_id>\d+)/(?P<object_id>.+)/$',
|
|
||||||
wrap(contenttype_views.shortcut),
|
|
||||||
name='view_on_site'),
|
|
||||||
url(r'^(?P<app_label>\w+)/$',
|
|
||||||
wrap(self.app_index),
|
|
||||||
name='app_list')
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add in each model's views.
|
# Add in each model's views.
|
||||||
for model, model_admin in six.iteritems(self._registry):
|
for model, model_admin in six.iteritems(self._registry):
|
||||||
urlpatterns += patterns('',
|
urlpatterns += patterns('',
|
||||||
url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name),
|
url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls))
|
||||||
include(model_admin.urls))
|
|
||||||
)
|
)
|
||||||
return urlpatterns
|
return urlpatterns
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue