0

Is possible to have action display in Django Admin with a different name than its function name?

for example:


 def an_action():
   pass

class AdminPanel(admin.ModelAdmin):
   actions = [ an_action]

In the Django admin panel an_action would display as "An action". Could I made this display something arbitrary like "Best Action Ever" instead of "An Action"?

Josh Martin
  • 311
  • 3
  • 18

1 Answers1

1

Try this:

def an_action():
   pass
an_action.short_description = 'my label'

class AdminPanel(admin.ModelAdmin):
   actions = [an_action]