I understand that but, there isn't a way to safely change the app_label attribute. As I understand, django manages the apps through INSTALLED_APPS and django admin strips the app name from the module "path" (please correct me). For example:
Say I have the catalog app (package). Inside I have the Product model. Then, django admin takes the registered models and for each get it's model._meta.app_label ( https://github.com/django/django/blob/1.4.2/django/contrib/admin/sites.py#L337) and group. The model._meta.app_label is "created" by the ModelBase class at https://github.com/django/django/blob/1.4.2/django/db/models/base.py#L50. It looks one level up from the model module by splitting the string by the dots. In this case, "catalog.models", so the app_label would be "catalog". If it were "some.thing.catalog.models" the app_label would also be "catalog". The thing is that the app_label is used on other places like in https://github.com/django/django/blob/1.4.2/django/db/models/base.py#L205 to get a model so if I rename it on the class Meta it would raise an error. It's suppose to be used when you have models inside submodules of your app ( https://docs.djangoproject.com/en/1.4/ref/models/options/#app-label). Also, if I rename it arbitrarily I can't rename it to the spanish equivalent because of the "tilde" or however you say it. As an example, catalog (catalogue) in spanish is catálogo so it wouldn't be a valid module name. So, there's the dilemma. Any thoughts? I think I may have found a way but I will need to discuss it with active django developers because it will need tinkering of the Django source code and I don't want to mess it up. Where do I get in touch with some developer? El miércoles, 5 de diciembre de 2012 17:53:43 UTC-3, Chris Cogdon escribió: > > Most objects have a way of giving them a "label" attribute, or even a > "short_description" attribute. So, if you didn't want to go to the trouble > of internationalizing (i17ning?) your application, just use those idioms to > create visible names for your custom-created models and forms, etc. > > To change the django-supplied names, then that should just be a matter of > switching the language in the settings. > > If you want to change the "Django Administration" name to something app > specific, then I would supply a new admin/base_site.html template (copy the > one from django-source/contrib/admin/templates/admin, modify it, and put it > into a templates/admin folder in your own app) > > > > On Tuesday, December 4, 2012 8:58:38 PM UTC-8, Pedro J. Aramburu wrote: >> >> I hope someone could help me. My main language is Spanish but when I >> write code I like it to be en english. Being that way it will be easier to >> open source something in the future. The main problem is the app name in >> the Admin Site. >> For example, I'm writing a kind of eCommerce site without the ability to >> make transactions (or buy) online. So it's more like a product >> catalog/catalogue. For that reason I created a catalog app with the desired >> modules, etc. When I configure the admin site then, I have the Catalog >> section with the CRUD for the models but, as my main language is Spanish, >> my clients also read Spanish so instead of "Catalog" it should say >> "Catálogo". >> I've read the documentation and googled a lot and find some "solutions" >> but they were pretty old. The most promising was to modify the admin site >> templates and put something like the following on the __init__.py file: >> >> from django.utils.translation import ugettext_noop as _ >> >> _('Catalog') >> >> >> That way the makemessages would pick the string and then I could >> translate it. Well, it didn't work. >> >> I found that the templates have some translation applied to them but I >> then realized that the app.name isn't translated but the surroundings >> are ( >> https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/index.html). >> >> The app.name is just a string interpolation. >> >> Have been any progress regarding this subject? Have anyone had to deal >> with something like this? Can I change the app name in some way or the >> app_label? What's the difference? How should approach it? Isn't somewhere a >> verbose_name for apps or something? Even if it's hard coded, with no >> translation. >> >> Thank you in advance for your time. >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/nZ9P2g4qnvgJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.