Permalink
Browse files

Used application verbose names in the admin.

  • Loading branch information...
aaugustin committed Dec 20, 2013
1 parent 690d1cb commit ba60fcbcf7645afd82f3135ecb56562f8a9c9824
@@ -71,7 +71,6 @@ def delete_selected(modeladmin, request, queryset):
"perms_lacking": perms_needed,
"protected": protected,
"opts": opts,
- "app_label": app_label,
'action_checkbox_name': helpers.ACTION_CHECKBOX_NAME,
}
@@ -1308,7 +1308,6 @@ def add_view(self, request, form_url='', extra_context=None):
media=media,
inline_admin_formsets=inline_admin_formsets,
errors=helpers.AdminErrorList(form, formsets),
- app_label=opts.app_label,
preserved_filters=self.get_preserved_filters(request),
)
context.update(extra_context or {})
@@ -1532,7 +1531,6 @@ def changelist_view(self, request, extra_context=None):
media=media,
has_add_permission=self.has_add_permission(request),
opts=cl.opts,
- app_label=app_label,
action_form=action_form,
actions_on_top=self.actions_on_top,
actions_on_bottom=self.actions_on_bottom,
@@ -1627,7 +1625,6 @@ def history_view(self, request, object_id, extra_context=None):
action_list=action_list,
module_name=capfirst(force_text(opts.verbose_name_plural)),
object=obj,
- app_label=app_label,
opts=opts,
preserved_filters=self.get_preserved_filters(request),
)
@@ -381,7 +381,7 @@ def index(self, request, extra_context=None):
app_dict[app_label]['models'].append(model_dict)
else:
app_dict[app_label] = {
- 'name': app_label.title(),
+ 'name': app_cache.get_app_config(app_label).verbose_name,
'app_label': app_label,
'app_url': reverse('admin:app_list', kwargs={'app_label': app_label}, current_app=self.name),
'has_module_perms': has_module_perms,
@@ -390,7 +390,7 @@ def index(self, request, extra_context=None):
# Sort the apps alphabetically.
app_list = list(six.itervalues(app_dict))
- app_list.sort(key=lambda x: x['name'])
+ app_list.sort(key=lambda x: x['name'].lower())
# Sort the models alphabetically within each app.
for app in app_list:
@@ -408,6 +408,7 @@ def index(self, request, extra_context=None):
def app_index(self, request, app_label, extra_context=None):
user = request.user
+ app_name = app_cache.get_app_config(app_label).verbose_name
has_module_perms = user.has_module_perms(app_label)
if not has_module_perms:
raise PermissionDenied
@@ -442,7 +443,7 @@ def app_index(self, request, app_label, extra_context=None):
# something to display, add in the necessary meta
# information.
app_dict = {
- 'name': app_label.title(),
+ 'name': app_name,
'app_label': app_label,
'app_url': '',
'has_module_perms': has_module_perms,
@@ -453,7 +454,7 @@ def app_index(self, request, app_label, extra_context=None):
# Sort the models alphabetically within each app.
app_dict['models'].sort(key=lambda x: x['name'])
context = dict(self.each_context(),
- title=_('%s administration') % capfirst(app_label),
+ title=_('%s administration') % app_name,
app_list=[app_dict],
app_label=app_label,
)
@@ -11,7 +11,7 @@
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_label|capfirst|escape }}</a>
+&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
&rsaquo; <a href="{% url opts|admin_urlname:'change' original.pk|admin_urlquote %}">{{ original|truncatewords:"18" }}</a>
&rsaquo; {% trans 'Change password' %}
@@ -16,7 +16,7 @@
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ app_label|capfirst|escape }}</a>
+&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; {% if has_change_permission %}<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
&rsaquo; {% if add %}{% trans 'Add' %} {{ opts.verbose_name }}{% else %}{{ original|truncatewords:"18" }}{% endif %}
</div>
@@ -38,7 +38,7 @@
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-&rsaquo; <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ app_label|capfirst|escape }}</a>
+&rsaquo; <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a>
&rsaquo; {{ cl.opts.verbose_name_plural|capfirst }}
</div>
{% endblock %}
@@ -6,7 +6,7 @@
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-&rsaquo; <a href="{% url 'admin:app_list' app_label=app_label %}">{{ app_label|capfirst|escape }}</a>
+&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; <a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>
&rsaquo; {% trans 'Delete multiple objects' %}
</div>
@@ -4,7 +4,7 @@
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
-&rsaquo; <a href="{% url 'admin:app_list' app_label=app_label %}">{{ app_label|capfirst|escape }}</a>
+&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; <a href="{% url opts|admin_urlname:'changelist' %}">{{ module_name }}</a>
&rsaquo; <a href="{% url opts|admin_urlname:'change' object.pk|admin_urlquote %}">{{ object|truncatewords:"18" }}</a>
&rsaquo; {% trans 'History' %}

0 comments on commit ba60fcb

Please sign in to comment.