Re: Change label/title from an application added to django admin

1,969 views
Skip to first unread message

Mike Dewhirst

unread,
Dec 23, 2012, 7:52:48 PM12/23/12
to django...@googlegroups.com
On 24/12/2012 9:02am, Emiliano Dalla Verde Marcozzi wrote:
> Hello, I created an app called 'emp' with the command:
> django-admin.py startapp emp. Then, i edited my models.py, added an
> admin.py file to register my clases/models in the django admin. Now,
> when i login into the django admin, i have a list of Applications,
> and it says 'Emp' in that list. I want to change 'Emp' for another
> word, for example, 'Employee', how can i do that in django 1.4 ?
> Thanks in advance, Emiliano.

The software is easy but the database might be a bit harder. In the
database the tablenames all begin with the app name followed by an
underscore and then the model name.

If it was me (and not knowing any better) I would replicate emp as
employee right alongside and change the source to nominate employee as
the app name. Add employee as another app and manage.py syncdb again.

That would give you a second app alongside emp in the admin.

Depending on how much data you have, you could dump from emp and load
into employee or simply re-enter your data.

When everything is working, drop emp.

Mike

>
> -- 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/-/waP0XrU8ywwJ. To
> post to this group, send email to django...@googlegroups.com. To
> unsubscribe from this group, send email to
> django-users...@googlegroups.com. For more options, visit
> this group at http://groups.google.com/group/django-users?hl=en.

ankush...@gmail.com

unread,
Dec 23, 2012, 9:02:45 PM12/23/12
to django...@googlegroups.com
Hi,
Look at the ⁠Meta⁠ options ⁠verbose_name⁠ and ⁠verbose_name_plural⁠

Using these you can change the display name in admin.

Cheers,
Ankush Chadda
Sent from BlackBerry® on Airtel

From: Emiliano Dalla Verde Marcozzi <6564...@gmail.com>
Date: Sun, 23 Dec 2012 14:02:21 -0800 (PST)
Subject: Change label/title from an application added to django admin

Hello,
I created an app called 'emp' with the command: django-admin.py startapp emp.
Then, i edited my models.py, added an admin.py file to register my clases/models
in the django admin. Now, when i login into the django admin, i have a list of
Applications, and it says 'Emp' in that list. I want to change 'Emp' for another word,
for example, 'Employee', how can i do that in django 1.4 ?
Thanks in advance,
Emiliano.

donarb

unread,
Dec 23, 2012, 11:26:54 PM12/23/12
to django...@googlegroups.com, ankush...@gmail.com


On Sunday, December 23, 2012 6:02:45 PM UTC-8, Ankush Chadda wrote:
Hi,
Look at the ⁠Meta⁠ options ⁠verbose_name⁠ and ⁠verbose_name_plural⁠

Using these you can change the display name in admin.



Those are for the displaying the model names, not the app name.
 

Pedro J. Aramburu

unread,
Jan 6, 2013, 10:06:13 AM1/6/13
to django...@googlegroups.com
Currently, there isn't a proper way of doing it. I will say that your best choice is to edit the template for the admin "index" and the "app index" so if app_name is "Emp" call it other way.

I know it's a dirty hack but currently there is no "standard" application on django so there isn't an editable app_name. There is an app_label but it's used when you have models on other places than models.py or something like that then, app_name is get from the app_label which is the last term in the installed_apps string splitted by dots but I think it actually get's it from the model namespace, as the second last term. myapp.Model then app_label is myapp. some.thing.other.Model think it's other.
Reply all
Reply to author
Forward
0 new messages