Ticket #1390: app-name-in-admin-breadcrumbs.diff
File app-name-in-admin-breadcrumbs.diff, 10.5 KB (added by , 17 years ago) |
---|
-
django/contrib/admin/media/css/global.css
5 5 a:hover { color: #036; } 6 6 a img { border:none; } 7 7 8 a.section:link, a.section:visited { color: white; text-decoration:none; } 9 8 10 /* GLOBAL DEFAULTS */ 9 11 p, ol, ul, dl { margin:.2em 0 .8em 0; } 10 12 p { padding:0; line-height:140%; } -
django/contrib/admin/options.py
489 489 'show_delete': False, 490 490 'media': media, 491 491 'inline_admin_formsets': inline_admin_formsets, 492 'app_label': app_label, 492 493 }) 493 494 return render_change_form(self, model, model.AddManipulator(), c, add=True) 494 495 … … 565 566 'is_popup': request.REQUEST.has_key('_popup'), 566 567 'media': media, 567 568 'inline_admin_formsets': inline_admin_formsets, 569 'app_label': app_label, 568 570 }) 569 571 return render_change_form(self, model, model.ChangeManipulator(object_id), c, change=True) 570 572 … … 591 593 'title': cl.title, 592 594 'is_popup': cl.is_popup, 593 595 'cl': cl, 596 'app_label': app_label, 594 597 }) 595 598 c.update({'has_add_permission': c['perms'][app_label][opts.get_add_permission()]}), 596 599 return render_to_response(['admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()), … … 633 636 request.user.message_set.create(message=_('The %(name)s "%(obj)s" was deleted successfully.') % {'name': force_unicode(opts.verbose_name), 'obj': force_unicode(obj_display)}) 634 637 return HttpResponseRedirect("../../") 635 638 extra_context = { 636 "title": _("Are you sure?"), 637 "object_name": opts.verbose_name, 638 "object": obj, 639 "deleted_objects": deleted_objects, 640 "perms_lacking": perms_needed, 641 "opts": opts, 639 'title': _('Are you sure?'), 640 'object_name': opts.verbose_name, 641 'object': obj, 642 'deleted_objects': deleted_objects, 643 'perms_lacking': perms_needed, 644 'opts': opts, 645 'app_label': app_label, 642 646 } 643 return render_to_response([ "admin/%s/%s/delete_confirmation.html"% (app_label, opts.object_name.lower() ),644 "admin/%s/delete_confirmation.html"% app_label ,645 "admin/delete_confirmation.html"], extra_context, context_instance=template.RequestContext(request))647 return render_to_response(['admin/%s/%s/delete_confirmation.html' % (app_label, opts.object_name.lower() ), 648 'admin/%s/delete_confirmation.html' % app_label , 649 'admin/delete_confirmation.html'], extra_context, context_instance=template.RequestContext(request)) 646 650 647 651 def history_view(self, request, object_id): 648 652 "The 'history' admin view for this model." -
django/contrib/admin/templates/admin/change_list.html
7 7 8 8 {% block userlinks %}<a href="../../doc/">{% trans 'Documentation' %}</a> / <a href="../../password_change/">{% trans 'Change password' %}</a> / <a href="../../logout/">{% trans 'Log out' %}</a>{% endblock %} 9 9 10 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %}10 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> › <a href="../">{{ app_label|capfirst|escape }}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %} 11 11 12 12 {% block coltype %}flex{% endblock %} 13 13 -
django/contrib/admin/templates/admin/index.html
16 16 {% for app in app_list %} 17 17 <div class="module"> 18 18 <table summary="{% blocktrans with app.name as name %}Models available in the {{ name }} application.{% endblocktrans %}"> 19 <caption> {% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</caption>19 <caption><a href="{{ app.app_url }}" class="section">{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}</a></caption> 20 20 {% for model in app.models %} 21 21 <tr> 22 22 {% if model.perms.change %} -
django/contrib/admin/templates/admin/app_index.html
1 {% extends "admin/index.html" %} 2 {% load i18n %} 3 4 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% trans "Home" %}</a> › {% for app in app_list %}{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %}{% endfor %}</div>{% endblock %}{% endif %} 5 {% block sidebar %}{% endblock %} 6 No newline at end of file -
django/contrib/admin/templates/admin/change_form.html
17 17 {% block breadcrumbs %}{% if not is_popup %} 18 18 <div class="breadcrumbs"> 19 19 <a href="../../../">{% trans "Home" %}</a> › 20 <a href="../../">{{ app_label|capfirst|escape }}</a> › 20 21 <a href="../">{{ opts.verbose_name_plural|capfirst|escape }}</a> › 21 22 {% if add %}{% trans "Add" %} {{ opts.verbose_name|escape }}{% else %}{{ original|truncatewords:"18"|escape }}{% endif %} 22 23 </div> -
django/contrib/admin/templates/admin/delete_confirmation.html
6 6 {% block breadcrumbs %} 7 7 <div class="breadcrumbs"> 8 8 <a href="../../../../">{% trans "Home" %}</a> › 9 <a href="../../../">{{ app_label|capfirst|escape }}</a> › 9 10 <a href="../../">{{ opts.verbose_name_plural|capfirst|escape }}</a> › 10 11 <a href="../">{{ object|escape|truncatewords:"18" }}</a> › 11 12 {% trans 'Delete' %} -
django/contrib/admin/sites.py
114 114 if not self.has_permission(request): 115 115 return self.login(request) 116 116 117 118 117 if url == '': 119 118 return self.index(request) 120 119 elif url == 'password_change': … … 127 126 match = USER_CHANGE_PASSWORD_URL_RE.match(url) 128 127 if match: 129 128 return self.user_change_password(request, match.group(1)) 130 129 131 130 if '/' in url: 132 131 return self.model_page(request, *url.split('/', 2)) 132 else: 133 return self.app_index(request, url) 133 134 134 135 raise http.Http404('The requested admin page does not exist.') 135 136 … … 276 277 else: 277 278 app_dict[app_label] = { 278 279 'name': app_label.title(), 280 'app_url': app_label, 279 281 'has_module_perms': has_module_perms, 280 282 'models': [model_dict], 281 283 } … … 293 295 'app_list': app_list, 294 296 }, context_instance=template.RequestContext(request)) 295 297 298 def app_index(self, request, app_label): 299 """ 300 Displays the application's index page, which lists all of 301 the application's models 302 """ 303 304 user = request.user 305 has_module_perms = user.has_module_perms(app_label) 306 app_dict = {} 307 for model, model_admin in self._registry.items(): 308 if app_label == model._meta.app_label: 309 if has_module_perms: 310 perms = { 311 'add': user.has_perm("%s.%s" % (app_label, model._meta.get_add_permission())), 312 'change': user.has_perm("%s.%s" % (app_label, model._meta.get_change_permission())), 313 'delete': user.has_perm("%s.%s" % (app_label, model._meta.get_delete_permission())), 314 } 315 316 # Check whether user has any perm for this module. 317 # If so, add the module to the model_list. 318 if True in perms.values(): 319 model_dict = { 320 'name': capfirst(model._meta.verbose_name_plural), 321 'admin_url': '%s/' % model.__name__.lower(), 322 'perms': perms, 323 } 324 if app_dict: 325 app_dict['models'].append(model_dict) 326 else: 327 app_dict = { 328 'name': app_label.title(), 329 'app_url':'', 330 'has_module_perms': has_module_perms, 331 'models': [model_dict], 332 } 333 if not app_dict: 334 raise http.Http404('The requested admin page does not exist.') 335 # Sort the models alphabetically within each app. 336 app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name'])) 337 338 return render_to_response('admin/app_index.html', { 339 'title': _('%s administration' % capfirst(app_label)), 340 'app_list': [app_dict,], 341 }, context_instance=template.RequestContext(request)) 342 296 343 # This global object represents the default admin site, for the common case. 297 344 # You can instantiate AdminSite in your own code to create a custom admin site. 298 345 site = AdminSite()