As an alternative to creating AppConfig class, what about registering app names, just like we register ModelAdmin instances:
admin.site.register_app_label("myapp", _("My awesome web app")) - Sergiy On Thu, Dec 6, 2012 at 11:57 PM, Pedro J. Aramburu <paramb...@tres42.com.ar>wrote: > As I explained on the Django users forums ( > https://groups.google.com/forum/?fromgroups=#!topic/django-users/ZUxZHi_-5ug) > I'm spanish speaking so my users are too. Writing code in spanish isn't > pretty and with characters like "á" or "ñ" it's very difficult to name the > apps a way that would make sense to show on the Admin site. > That being said, I would like to propose a solution because all the > tickets and solutions I found won't work properly or are very outdated but > I need consent and guidance on how to approach it and with the internals of > django.contrib.admin and django.db. > > My solution consists on a class on the __init__.py file on the module > (app), maybe it can be call AppConfig, where some metadata about the app > can be stored. Then, django.contrib.admin could pick it up to name the app > and maybe add a description or help_text and if it's not there it could > fall back to the previous method with app_label. > > As an example: > > __init__.py > > class AppConfig: > verbose_name = 'app pretty name in any' > description = 'app short description' > > I chose verbose_name to keep it consistent with fields and models but it > could be called however you want (even pretty_name). Maybe on the future > AppConfig could be used for other purposes but it has to start somewhere. > This way you could also use ugettext_lazy to translate the name and > description. > > django.db.models won't need to be touched because they don't need the > "pretty name" but django.contrib.admin could try to pick up the AppConfig > to get the pretty name. > > > https://github.com/django/django/blob/1.4.2/django/contrib/admin/sites.py#L365 > > https://github.com/django/django/blob/1.4.2/django/contrib/admin/sites.py#L421 > > There it could return the verbose_name.title() or fall back to the > app_label.title() so then in the template there will be no need to change > anything (if we don't implement any other functionality yet). > > What do you think? Please let me know if it's the best approach and if it > would be considered to merge it on the project. Mostly because non-english > speakers need some default solution to make the django admin work for their > sites but keeping the code in english. > > Thank you in advance for your thoughts on this. > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-developers/-/hwUExTid2UEJ. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.