PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, October 19, 2022

[FIXED] How to add actions to admin page with non-ascii charecters

 October 19, 2022     admin, django, non-ascii-characters     No comments   

Issue

I have this code which works fine in Django admin page, but is there a way to keep action name in Russian but function name in English?

actions = ["Отправить_сообщение"]  # add action to list page

def Отправить_сообщение(self, request, queryset):
    pass

cheers


Solution

Yes, see here: https://docs.djangoproject.com/en/3.0/ref/contrib/admin/actions/#writing-action-functions

For your code:

actions = ["my_action"]

def my_action(self, request, queryset):
    pass

my_action.short_description = "Отправить сообщение"

Another way (better if you handle multiple languages) is to use the internationalization framework.



Answered By - Tom Carrick
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing