Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I change titles in action section in Django admin panel?

I want to change titles in action section in Django admin. How can I do that?
enter image description here

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The description [GitHub] is defined in the django.contrib.admin.actions module with:

@action(
    permissions=["delete"],
    description=gettext_lazy("Delete selected %(verbose_name_plural)s"),
)
def delete_selected(modeladmin, request, queryset):
    # …

It takes the verbose_name_plural of the model. You thus can change the verbose_name_plural with:

class Article(models.Model):
    # …

    class Meta:
        verbose_name_plural = 'publications'
        # …

or you can make a translation file that translates it to something else, but you are limited to what the Django modeladmin passes to the formatter.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading