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