Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #8577 -- Fixed a couple of indentation errors when viewing the …

…app-index

page in admin. Patch by evenrik.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6e51f051124ca88ae0ffb6168e1e30d61d712237 1 parent 3b993b2
@malcolmt malcolmt authored
Showing with 17 additions and 14 deletions.
  1. +17 −14 django/contrib/admin/sites.py
View
31 django/contrib/admin/sites.py
@@ -112,7 +112,7 @@ def has_permission(self, request):
*at least one* page in the admin site.
"""
return request.user.is_authenticated() and request.user.is_staff
-
+
def check_dependencies(self):
"""
Check that all things needed to run the admin have been correctly installed.
@@ -139,7 +139,7 @@ def root(self, request, url):
"""
if request.method == 'GET' and not request.path.endswith('/'):
return http.HttpResponseRedirect(request.path + '/')
-
+
if settings.DEBUG:
self.check_dependencies()
@@ -365,7 +365,7 @@ def display_login_form(self, request, error_message='', extra_context=None):
return render_to_response(self.login_template or 'admin/login.html', context,
context_instance=template.RequestContext(request)
)
-
+
def app_index(self, request, app_label, extra_context=None):
user = request.user
has_module_perms = user.has_module_perms(app_label)
@@ -386,17 +386,20 @@ def app_index(self, request, app_label, extra_context=None):
'admin_url': '%s/' % model.__name__.lower(),
'perms': perms,
}
- if app_dict:
- app_dict['models'].append(model_dict),
- else:
- app_dict = {
- 'name': app_label.title(),
- 'app_url': '',
- 'has_module_perms': has_module_perms,
- 'models': [model_dict],
- }
- if not app_dict:
- raise http.Http404('The requested admin page does not exist.')
+ if app_dict:
+ app_dict['models'].append(model_dict),
+ else:
+ # First time around, now that we know there's
+ # something to display, add in the necessary meta
+ # information.
+ app_dict = {
+ 'name': app_label.title(),
+ 'app_url': '',
+ 'has_module_perms': has_module_perms,
+ 'models': [model_dict],
+ }
+ if not app_dict:
+ raise http.Http404('The requested admin page does not exist.')
# Sort the models alphabetically within each app.
app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))
context = {
Please sign in to comment.
Something went wrong with that request. Please try again.