Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed awkward indentation in admin URLconfs

  • Loading branch information...
commit 273a1e6b8d42f9c0d2ff8ad88eedbc83ae3ee12b 1 parent be983ee
Adrian Holovaty authored September 06, 2013
20  django/contrib/admin/options.py
@@ -470,21 +470,11 @@ def wrapper(*args, **kwargs):
470 470
         info = self.model._meta.app_label, self.model._meta.model_name
471 471
 
472 472
         urlpatterns = patterns('',
473  
-            url(r'^$',
474  
-                wrap(self.changelist_view),
475  
-                name='%s_%s_changelist' % info),
476  
-            url(r'^add/$',
477  
-                wrap(self.add_view),
478  
-                name='%s_%s_add' % info),
479  
-            url(r'^(.+)/history/$',
480  
-                wrap(self.history_view),
481  
-                name='%s_%s_history' % info),
482  
-            url(r'^(.+)/delete/$',
483  
-                wrap(self.delete_view),
484  
-                name='%s_%s_delete' % info),
485  
-            url(r'^(.+)/$',
486  
-                wrap(self.change_view),
487  
-                name='%s_%s_change' % info),
  473
+            url(r'^$', wrap(self.changelist_view), name='%s_%s_changelist' % info),
  474
+            url(r'^add/$', wrap(self.add_view), name='%s_%s_add' % info),
  475
+            url(r'^(.+)/history/$', wrap(self.history_view), name='%s_%s_history' % info),
  476
+            url(r'^(.+)/delete/$', wrap(self.delete_view), name='%s_%s_delete' % info),
  477
+            url(r'^(.+)/$', wrap(self.change_view), name='%s_%s_change' % info),
488 478
         )
489 479
         return urlpatterns
490 480
 
34  django/contrib/admin/sites.py
@@ -190,8 +190,7 @@ def inner(request, *args, **kwargs):
190 190
             if LOGIN_FORM_KEY in request.POST and request.user.is_authenticated():
191 191
                 auth_logout(request)
192 192
             if not self.has_permission(request):
193  
-                if request.path == reverse('admin:logout',
194  
-                                           current_app=self.name):
  193
+                if request.path == reverse('admin:logout', current_app=self.name):
195 194
                     index_path = reverse('admin:index', current_app=self.name)
196 195
                     return HttpResponseRedirect(index_path)
197 196
                 return self.login(request)
@@ -217,34 +216,19 @@ def wrapper(*args, **kwargs):
217 216
 
218 217
         # Admin-site-wide views.
219 218
         urlpatterns = patterns('',
220  
-            url(r'^$',
221  
-                wrap(self.index),
222  
-                name='index'),
223  
-            url(r'^logout/$',
224  
-                wrap(self.logout),
225  
-                name='logout'),
226  
-            url(r'^password_change/$',
227  
-                wrap(self.password_change, cacheable=True),
228  
-                name='password_change'),
229  
-            url(r'^password_change/done/$',
230  
-                wrap(self.password_change_done, cacheable=True),
231  
-                name='password_change_done'),
232  
-            url(r'^jsi18n/$',
233  
-                wrap(self.i18n_javascript, cacheable=True),
234  
-                name='jsi18n'),
235  
-            url(r'^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$',
236  
-                wrap(contenttype_views.shortcut),
237  
-                name='view_on_site'),
238  
-            url(r'^(?P<app_label>\w+)/$',
239  
-                wrap(self.app_index),
240  
-                name='app_list')
  219
+            url(r'^$', wrap(self.index), name='index'),
  220
+            url(r'^logout/$', wrap(self.logout), name='logout'),
  221
+            url(r'^password_change/$', wrap(self.password_change, cacheable=True), name='password_change'),
  222
+            url(r'^password_change/done/$', wrap(self.password_change_done, cacheable=True), name='password_change_done'),
  223
+            url(r'^jsi18n/$', wrap(self.i18n_javascript, cacheable=True), name='jsi18n'),
  224
+            url(r'^r/(?P<content_type_id>\d+)/(?P<object_id>.+)/$', wrap(contenttype_views.shortcut), name='view_on_site'),
  225
+            url(r'^(?P<app_label>\w+)/$', wrap(self.app_index), name='app_list'),
241 226
         )
242 227
 
243 228
         # Add in each model's views.
244 229
         for model, model_admin in six.iteritems(self._registry):
245 230
             urlpatterns += patterns('',
246  
-                url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name),
247  
-                    include(model_admin.urls))
  231
+                url(r'^%s/%s/' % (model._meta.app_label, model._meta.model_name), include(model_admin.urls))
248 232
             )
249 233
         return urlpatterns
250 234
 

0 notes on commit 273a1e6

Please sign in to comment.
Something went wrong with that request. Please try again.