In Django Admin, in the changelist view there is a Add <model_name> button at the top right hand corner.
Does anyone have any idea how to change the default text in that button?
UPDATE
I want to change the word Add to something else
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With