Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed awkward indentation in admin URLconfs

  • Loading branch information...
commit 273a1e6b8d42f9c0d2ff8ad88eedbc83ae3ee12b 1 parent be983ee
Adrian Holovaty adrianholovaty authored
Showing with 14 additions and 40 deletions.
  1. +5 −15 django/contrib/admin/options.py
  2. +9 −25 django/contrib/admin/sites.py
20 django/contrib/admin/options.py
View
@@ -470,21 +470,11 @@ def wrapper(*args, **kwargs):
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
34 django/contrib/admin/sites.py
View
@@ -190,8 +190,7 @@ def inner(request, *args, **kwargs):
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 @@ def wrapper(*args, **kwargs):
# 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<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')
+ 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<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.
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
Please sign in to comment.
Something went wrong with that request. Please try again.