Ticket #1390: app-name-in-admin-breadcrumbs2.diff
File app-name-in-admin-breadcrumbs2.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
526 526 'show_delete': False, 527 527 'media': mark_safe(media), 528 528 'inline_admin_formsets': inline_admin_formsets, 529 'app_label': app_label, 529 530 }) 530 531 return self.render_change_form(request, model, c, add=True) 531 532 … … 601 602 'is_popup': request.REQUEST.has_key('_popup'), 602 603 'media': mark_safe(media), 603 604 'inline_admin_formsets': inline_admin_formsets, 605 'app_label': app_label, 604 606 }) 605 607 return self.render_change_form(request, model, c, change=True, obj=obj) 606 608 … … 627 629 'title': cl.title, 628 630 'is_popup': cl.is_popup, 629 631 'cl': cl, 632 'app_label': app_label, 630 633 }) 631 634 c.update({'has_add_permission': self.has_add_permission(request)}), 632 635 return render_to_response(['admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()), … … 669 672 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)}) 670 673 return HttpResponseRedirect("../../") 671 674 extra_context = { 672 "title": _("Are you sure?"), 673 "object_name": opts.verbose_name, 674 "object": obj, 675 "deleted_objects": deleted_objects, 676 "perms_lacking": perms_needed, 677 "opts": opts, 675 'title': _('Are you sure?'), 676 'object_name': opts.verbose_name, 677 'object': obj, 678 'deleted_objects': deleted_objects, 679 'perms_lacking': perms_needed, 680 'opts': opts, 681 'app_label': app_label, 678 682 } 679 return render_to_response([ "admin/%s/%s/delete_confirmation.html"% (app_label, opts.object_name.lower() ),680 "admin/%s/delete_confirmation.html"% app_label ,681 "admin/delete_confirmation.html"], extra_context, context_instance=template.RequestContext(request))683 return render_to_response(['admin/%s/%s/delete_confirmation.html' % (app_label, opts.object_name.lower() ), 684 'admin/%s/delete_confirmation.html' % app_label , 685 'admin/delete_confirmation.html'], extra_context, context_instance=template.RequestContext(request)) 682 686 683 687 def history_view(self, request, object_id): 684 688 "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 }}</a> › 21 22 {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% 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 }}</a> › 10 11 <a href="../">{{ object|escape|truncatewords:"18" }}</a> › 11 12 {% trans 'Delete' %} -
django/contrib/admin/sites.py
115 115 if not self.has_permission(request): 116 116 return self.login(request) 117 117 118 119 118 if url == '': 120 119 return self.index(request) 121 120 elif url == 'password_change': … … 132 131 match = USER_CHANGE_PASSWORD_URL_RE.match(url) 133 132 if match: 134 133 return self.user_change_password(request, match.group(1)) 135 134 136 135 if '/' in url: 137 136 return self.model_page(request, *url.split('/', 2)) 137 else: 138 return self.app_index(request, url) 138 139 139 140 raise http.Http404('The requested admin page does not exist.') 140 141 … … 281 282 else: 282 283 app_dict[app_label] = { 283 284 'name': app_label.title(), 285 'app_url': app_label, 284 286 'has_module_perms': has_module_perms, 285 287 'models': [model_dict], 286 288 } … … 298 300 'app_list': app_list, 299 301 }, context_instance=template.RequestContext(request)) 300 302 303 def app_index(self, request, app_label): 304 """ 305 Displays the application's index page, which lists all of 306 the application's models 307 """ 308 309 user = request.user 310 has_module_perms = user.has_module_perms(app_label) 311 app_dict = {} 312 for model, model_admin in self._registry.items(): 313 if app_label == model._meta.app_label: 314 if has_module_perms: 315 perms = { 316 'add': user.has_perm("%s.%s" % (app_label, model._meta.get_add_permission())), 317 'change': user.has_perm("%s.%s" % (app_label, model._meta.get_change_permission())), 318 'delete': user.has_perm("%s.%s" % (app_label, model._meta.get_delete_permission())), 319 } 320 321 # Check whether user has any perm for this module. 322 # If so, add the module to the model_list. 323 if True in perms.values(): 324 model_dict = { 325 'name': capfirst(model._meta.verbose_name_plural), 326 'admin_url': '%s/' % model.__name__.lower(), 327 'perms': perms, 328 } 329 if app_dict: 330 app_dict['models'].append(model_dict) 331 else: 332 app_dict = { 333 'name': app_label.title(), 334 'app_url':'', 335 'has_module_perms': has_module_perms, 336 'models': [model_dict], 337 } 338 if not app_dict: 339 raise http.Http404('The requested admin page does not exist.') 340 # Sort the models alphabetically within each app. 341 app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name'])) 342 343 return render_to_response('admin/app_index.html', { 344 'title': _('%s administration' % capfirst(app_label)), 345 'app_list': [app_dict,], 346 }, context_instance=template.RequestContext(request)) 347 301 348 # This global object represents the default admin site, for the common case. 302 349 # You can instantiate AdminSite in your own code to create a custom admin site. 303 350 site = AdminSite()