Django

Code

Ticket #1390: updated_app_name_link2.diff

File updated_app_name_link2.diff, 8.7 kB (added by juliae, 5 months ago)
  • django/contrib/admin/media/css/global.css

    old new  
    44a:link, a:visited { color: #5b80b2; text-decoration:none; } 
    55a:hover { color: #036; } 
    66a img { border:none; } 
     7a.section:link, a.section:visited { color: white; text-decoration:none; } 
    78 
    89/* GLOBAL DEFAULTS */ 
    910p, ol, ul, dl { margin:.2em 0 .8em 0; } 
  • django/contrib/admin/options.py

    old new  
    519519            'inline_admin_formsets': inline_admin_formsets, 
    520520            'errors': helpers.AdminErrorList(form, formsets), 
    521521            'root_path': self.admin_site.root_path, 
     522            'app_label': app_label, 
    522523        } 
    523524        context.update(extra_context or {}) 
    524525        return self.render_change_form(request, context, add=True) 
     
    597598            'inline_admin_formsets': inline_admin_formsets, 
    598599            'errors': helpers.AdminErrorList(form, formsets), 
    599600            'root_path': self.admin_site.root_path, 
     601            'app_label': app_label, 
    600602        } 
    601603        context.update(extra_context or {}) 
    602604        return self.render_change_form(request, context, change=True, obj=obj) 
     
    628630            'cl': cl, 
    629631            'has_add_permission': self.has_add_permission(request), 
    630632            'root_path': self.admin_site.root_path, 
     633            'app_label': app_label, 
    631634        } 
    632635        context.update(extra_context or {}) 
    633636        return render_to_response(self.change_list_template or [ 
     
    682685            "perms_lacking": perms_needed, 
    683686            "opts": opts, 
    684687            "root_path": self.admin_site.root_path, 
     688            "app_label": app_label, 
    685689        } 
    686690        context.update(extra_context or {}) 
    687691        return render_to_response(self.delete_confirmation_template or [ 
  • django/contrib/admin/templates/admin/change_list.html

    old new  
    55 
    66{% block bodyclass %}change-list{% endblock %} 
    77 
    8 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> &rsaquo; {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %} 
     8{% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../">{% trans "Home" %}</a> &rsaquo; <a href="../">{{ app_label|capfirst|escape }}</a> &rsaquo; {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %} 
    99 
    1010{% block coltype %}flex{% endblock %} 
    1111 
  • django/contrib/admin/templates/admin/index.html

    old new  
    1616    {% for app in app_list %} 
    1717        <div class="module"> 
    1818        <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> 
    2020        {% for model in app.models %} 
    2121            <tr> 
    2222            {% if model.perms.change %} 
  • django/contrib/admin/templates/admin/app_index.html

    old new  
     1{% extends "admin/index.html" %}  
     2{% load i18n %}  
     3 
     4{% if not is_popup %} 
     5 
     6{% block breadcrumbs %} 
     7<div class="breadcrumbs"><a href="../"> 
     8{% trans "Home" %}</a> &rsaquo;  
     9{% for app in app_list %} 
     10{% blocktrans with app.name as name %}{{ name }}{% endblocktrans %} 
     11{% endfor %}</div>{% endblock %} 
     12 
     13{% endif %}  
     14 
     15{% block sidebar %}{% endblock %} 
  • django/contrib/admin/templates/admin/change_form.html

    old new  
    1515{% block breadcrumbs %}{% if not is_popup %} 
    1616<div class="breadcrumbs"> 
    1717     <a href="../../../">{% trans "Home" %}</a> &rsaquo; 
     18     <a href="../../">{{ app_label|capfirst|escape }}</a> &rsaquo;  
    1819     <a href="../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo; 
    1920     {% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %} 
    2021</div> 
  • django/contrib/admin/templates/admin/delete_confirmation.html

    old new  
    44{% block breadcrumbs %} 
    55<div class="breadcrumbs"> 
    66     <a href="../../../../">{% trans "Home" %}</a> &rsaquo; 
     7     <a href="../../../">{{ app_label|capfirst|escape }}</a> &rsaquo;  
    78     <a href="../../">{{ opts.verbose_name_plural|capfirst }}</a> &rsaquo; 
    89     <a href="../">{{ object|escape|truncatewords:"18" }}</a> &rsaquo; 
    910     {% trans 'Delete' %} 
  • django/contrib/admin/sites.py

    old new  
    170170        else: 
    171171            if '/' in url: 
    172172                return self.model_page(request, *url.split('/', 2)) 
     173            else: 
     174                    return self.app_index(request,url) 
    173175 
    174176        raise http.Http404('The requested admin page does not exist.') 
    175177 
     
    314316                    else: 
    315317                        app_dict[app_label] = { 
    316318                            'name': app_label.title(), 
     319                            'app_url': app_label, 
    317320                            'has_module_perms': has_module_perms, 
    318321                            'models': [model_dict], 
    319322                        } 
     
    359362        return render_to_response(self.login_template or 'admin/login.html', context, 
    360363            context_instance=template.RequestContext(request) 
    361364        ) 
     365     
     366    def app_index(self, request, app_label):  
    362367 
     368        user = request.user 
     369        has_module_perms = user.has_module_perms(app_label)  
     370        app_dict = {}  
     371        for model, model_admin in self._registry.items():  
     372            if app_label == model._meta.app_label:  
     373               if has_module_perms:  
     374                  perms = {  
     375                        'add': user.has_perm("%s.%s" % (app_label, model._meta.get_add_permission())),  
     376                        'change': user.has_perm("%s.%s" % (app_label, model._meta.get_change_permission())),  
     377                        'delete': user.has_perm("%s.%s" % (app_label, model._meta.get_delete_permission())), }  
     378                  # Check whether user has any perm for this module.  
     379                  # If so, add the module to the model_list.  
     380                  if True in perms.values():  
     381                         model_dict = {  
     382                                  'name': capfirst(model._meta.verbose_name_plural),  
     383                                  'admin_url': '%s/' % model.__name__.lower(),  
     384                              'perms': perms,}  
     385                  if app_dict:  
     386                     app_dict['models'].append(model_dict),  
     387                  else:  
     388                       app_dict = {  
     389                                       'name': app_label.title(),  
     390                                   'app_url': '',  
     391                                       'has_module_perms': has_module_perms,  
     392                                   'models': [model_dict],}  
     393                  if not app_dict:  
     394                         raise http.Http404('The requested admin page does not exist.')   
     395        # Sort the models alphabetically within each app. 
     396        app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))  
     397        return render_to_response('admin/app_index.html', {  
     398                   'title': _('%s administration' % capfirst(app_label)),  
     399               'app_list': [app_dict,],} 
     400               , context_instance=template.RequestContext(request))  
    363401 
    364402# This global object represents the default admin site, for the common case. 
    365403# You can instantiate AdminSite in your own code to create a custom admin site.