1

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

Darwin
  • 1,695
  • 1
  • 19
  • 29
  • You can define a translation file: https://github.com/django/django/blob/e1a093f8cba66574ce516a7510ded5196cdc6416/django/contrib/admin/actions.py#L17 – Willem Van Onsem Jan 22 '23 at 10:32

1 Answers1

1

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.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555