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
This commit is contained in:
Malcolm Tredinnick 2008-08-27 05:22:25 +00:00
parent 3b993b2995
commit 6e51f05112
1 changed files with 17 additions and 14 deletions

View File

@ -112,7 +112,7 @@ class AdminSite(object):
*at least one* page in the admin site. *at least one* page in the admin site.
""" """
return request.user.is_authenticated() and request.user.is_staff return request.user.is_authenticated() and request.user.is_staff
def check_dependencies(self): def check_dependencies(self):
""" """
Check that all things needed to run the admin have been correctly installed. Check that all things needed to run the admin have been correctly installed.
@ -139,7 +139,7 @@ class AdminSite(object):
""" """
if request.method == 'GET' and not request.path.endswith('/'): if request.method == 'GET' and not request.path.endswith('/'):
return http.HttpResponseRedirect(request.path + '/') return http.HttpResponseRedirect(request.path + '/')
if settings.DEBUG: if settings.DEBUG:
self.check_dependencies() self.check_dependencies()
@ -365,7 +365,7 @@ class AdminSite(object):
return render_to_response(self.login_template or 'admin/login.html', context, return render_to_response(self.login_template or 'admin/login.html', context,
context_instance=template.RequestContext(request) context_instance=template.RequestContext(request)
) )
def app_index(self, request, app_label, extra_context=None): def app_index(self, request, app_label, extra_context=None):
user = request.user user = request.user
has_module_perms = user.has_module_perms(app_label) has_module_perms = user.has_module_perms(app_label)
@ -386,17 +386,20 @@ class AdminSite(object):
'admin_url': '%s/' % model.__name__.lower(), 'admin_url': '%s/' % model.__name__.lower(),
'perms': perms, 'perms': perms,
} }
if app_dict: if app_dict:
app_dict['models'].append(model_dict), app_dict['models'].append(model_dict),
else: else:
app_dict = { # First time around, now that we know there's
'name': app_label.title(), # something to display, add in the necessary meta
'app_url': '', # information.
'has_module_perms': has_module_perms, app_dict = {
'models': [model_dict], 'name': app_label.title(),
} 'app_url': '',
if not app_dict: 'has_module_perms': has_module_perms,
raise http.Http404('The requested admin page does not exist.') 'models': [model_dict],
}
if not app_dict:
raise http.Http404('The requested admin page does not exist.')
# Sort the models alphabetically within each app. # Sort the models alphabetically within each app.
app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name'])) app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))
context = { context = {