Ticket #1390: updated_app_name_link.diff

File updated_app_name_link.diff, 10.3 KB (added by juliae, 7 years ago)
  • contrib/admin/media/css/global.css

     
    55a:hover { color: #036; }
    66a img { border:none; }
    77
     8a.section:link, a.section:visited { color: white; text-decoration:none; }
     9
    810/* GLOBAL DEFAULTS */
    911p, ol, ul, dl { margin:.2em 0 .8em 0; }
    1012p { padding:0; line-height:140%; }
  • contrib/admin/options.py

     
    546546            'inline_admin_formsets': inline_admin_formsets,
    547547            'errors': AdminErrorList(form, inline_formsets),
    548548            'root_path': self.admin_site.root_path,
     549            'app_label': app_label,
    549550        }
    550551        context.update(extra_context or {})
    551552        return self.render_change_form(request, context, add=True)
     
    609610            'inline_admin_formsets': inline_admin_formsets,
    610611            'errors': AdminErrorList(form, inline_formsets),
    611612            'root_path': self.admin_site.root_path,
     613            'app_label': app_label,
    612614        }
    613615        context.update(extra_context or {})
    614616        return self.render_change_form(request, context, change=True, obj=obj)
     
    639641            'cl': cl,
    640642            'has_add_permission': self.has_add_permission(request),
    641643            'root_path': self.admin_site.root_path,
     644            'app_label': app_label,
    642645        }
    643646        context.update(extra_context or {})
    644647        return render_to_response(self.change_list_template or [
     
    685688            return HttpResponseRedirect("../../")
    686689
    687690        context = {
    688             "title": _("Are you sure?"),
    689             "object_name": force_unicode(opts.verbose_name),
    690             "object": obj,
    691             "deleted_objects": deleted_objects,
    692             "perms_lacking": perms_needed,
    693             "opts": opts,
    694             "root_path": self.admin_site.root_path,
     691            'title': _('Are you sure?'),
     692            'object_name': opts.verbose_name,
     693            'object': obj,
     694            'deleted_objects': deleted_objects,
     695            'perms_lacking': perms_needed,
     696            'opts': opts,
     697            'root_path': self.admin_site.root_path,
     698            'app_label': app_label,
    695699        }
    696700        context.update(extra_context or {})
    697701        return render_to_response(self.delete_confirmation_template or [
    698             "admin/%s/%s/delete_confirmation.html" % (app_label, opts.object_name.lower()),
    699             "admin/%s/delete_confirmation.html" % app_label,
    700             "admin/delete_confirmation.html"
     702            'admin/%s/%s/delete_confirmation.html' % (app_label, opts.object_name.lower()),
     703            'admin/%s/delete_confirmation.html' % app_label,
     704            'admin/delete_confirmation.html'
    701705        ], context, context_instance=template.RequestContext(request))
    702706
    703707    def history_view(self, request, object_id, extra_context=None):
     
    720724        }
    721725        context.update(extra_context or {})
    722726        return render_to_response(self.object_history_template or [
    723             "admin/%s/%s/object_history.html" % (opts.app_label, opts.object_name.lower()),
    724             "admin/%s/object_history.html" % opts.app_label,
    725             "admin/object_history.html"
     727            'admin/%s/%s/object_history.html' % (opts.app_label, opts.object_name.lower()),
     728            'admin/%s/object_history.html' % opts.app_label,
     729            'admin/object_history.html'
    726730        ], context, context_instance=template.RequestContext(request))
    727731
    728732class InlineModelAdmin(BaseModelAdmin):
  • contrib/admin/templates/admin/change_list.html

     
    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
  • contrib/admin/templates/admin/index.html

     
    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 %}
  • contrib/admin/templates/admin/change_form.html

     
    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>
  • contrib/admin/templates/admin/delete_confirmation.html

     
    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' %}
  • contrib/admin/sites.py

     
    154154
    155155            if '/' in url:
    156156                return self.model_page(request, *url.split('/', 2))
     157            else:
     158                    return self.app_index(request,url)
    157159
    158160        raise http.Http404('The requested admin page does not exist.')
    159161
     
    305307                    else:
    306308                        app_dict[app_label] = {
    307309                            'name': app_label.title(),
     310                            'app_url': app_label,
    308311                            'has_module_perms': has_module_perms,
    309312                            'models': [model_dict],
    310313                        }
     
    350353        return render_to_response(self.login_template or 'admin/login.html', context,
    351354            context_instance=template.RequestContext(request)
    352355        )
     356   
     357    def app_index(self, request, app_label):
    353358
     359        # Displays the application's index page, which lists all of the application's models
    354360
     361        user = request.user
     362        has_module_perms = user.has_module_perms(app_label)
     363        app_dict = {}
     364        for model, model_admin in self._registry.items():
     365            if app_label == model._meta.app_label:
     366               if has_module_perms:
     367                   perms = {
     368                        'add': user.has_perm("%s.%s" % (app_label, model._meta.get_add_permission())),
     369                        'change': user.has_perm("%s.%s" % (app_label, model._meta.get_change_permission())),
     370                        'delete': user.has_perm("%s.%s" % (app_label, model._meta.get_delete_permission())), }
     371                        # Check whether user has any perm for this module.
     372                        # If so, add the module to the model_list.
     373                   if True in perms.values():
     374                            model_dict = {
     375                                'name': capfirst(model._meta.verbose_name_plural),
     376                                'admin_url': '%s/' % model.__name__.lower(),
     377                                'perms': perms,
     378                          }
     379                   if app_dict:
     380                      app_dict['models'].append(model_dict)
     381                   else:
     382                      app_dict = {
     383                                  'name': app_label.title(),
     384                                  'app_url': '',
     385                                  'has_module_perms': has_module_perms,
     386                                  'models': [model_dict],}
     387                   if not app_dict:
     388                      raise http.Http404('The requested admin page does not exist.')
     389           # Sort the models alphabetically within each app.
     390                   app_dict['models'].sort(lambda x, y: cmp(x['name'], y['name']))
     391       
     392                   return render_to_response('admin/app_index.html', {
     393                          'title': _('%s administration' % capfirst(app_label)),
     394                          'app_list': [app_dict,],
     395                   }, context_instance=template.RequestContext(request))
     396
    355397# This global object represents the default admin site, for the common case.
    356398# You can instantiate AdminSite in your own code to create a custom admin site.
    357399site = AdminSite()
  • contrib/auth/models.py

     
    7070
    7171    Three basic permissions -- add, change and delete -- are automatically created for each Django model.
    7272    """
    73     name = models.CharField(_('name'), max_length=50)
     73    name = models.CharField(_('name'), max_length=100)
    7474    content_type = models.ForeignKey(ContentType)
    7575    codename = models.CharField(_('codename'), max_length=100)
    7676
Back to Top