3👍
The changelist view renders the change_list.html file in django/contrib/admin/templates/admin directory.
Specifically, the snippet that you want to modify is
{% block content %}
<div id="content-main">
{% block object-tools %}
{% if has_add_permission %}
<ul class="object-tools">
{% block object-tools-items %}
<li>
<a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">
{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
</a>
</li>
{% endblock %}
</ul>
{% endif %}
{% endblock %}
So the bad news is that your “Add” user interface string as you can see is hardcoded.
The good news is, you can still override it by creating your own change_list.html template in your own project templates/admin/ directory. The specifics are explained here in django docs:-
https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates
and specifically in your case, it is simply to override the object-tools block on your own change_list.html file.
1👍
You will need to update your Django admin templates. The template you’re looking for is django/contrib/admin/templates/admin/change_list.html
. Look for addlink
, the line below that should be the word to change.
0👍
that’s the name for your model.
Django use model’s class name by default, but you can change it by Meta.verbose_name
class MyModel(models.Model):
name = models.CharField()
class Meta:
verbose_name = u"a_new_name"
- [Django]-Django query – Is it possible to group elements by common field at database level?
- [Django]-Css not working with FastCGI and Lighttpd