﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21622	Support consistent customization of app_label	Chris Spencer	nobody	"The app_label model meta attribute effects how both a table's name appears in the database as well as how the app's name appears in admin. Currently, it's very difficult to separate the ""logical"" usage of app_label from the ""aesthetic"" usage, the way we can with the db_table and verbose_name meta attributes for individual model names.

An example of when we might want to do this is when we want to create a django package where a non-Django package already exists. e.g. Say we want to create an admin interface for managing RSS feeds and call it ""djangofeeds"" but there's already a Python package called ""feeds"". We'd want the app_label to mirror the logical Python package name, but have it appear in admin as simply ""Feeds"" for clarity.

Another example when this would be useful is for renaming of the aesthetic appearance of an existing app without effecting the database. Currently, if you change app_label on an app with existing data, this also changes all the names of your tables, causing South migrations to delete your old tables along with all your data.

A partial solution to this problem is to use a class that overrides str.title, like:

{{{

    class StringWithTitle(str):
        """"""
        String class with a title method. Can be used to override 
        admin app names.

        http://ionelmc.wordpress.com/2011/06/24/custom-app-names-in-the-django-admin/
        """"""

        def __new__(cls, value, title):
            instance = str.__new__(cls, value)
            instance._title = title
            return instance

        def title(self):
            return self._title

        __copy__ = lambda self: self
        __deepcopy__ = lambda self, memodict: self

    class MyModel(models.Model):

        <columns>

        class Meta:
            app_label = StringWithTitle('my_app_label', 'My Fancy App Label')

}}}

However, in order for this to work everywhere in admin, all renderings of app_label would have to call title(). Unfortunately, admin renders app_labels inconsistently. In many places it calls title() but in others it calls capfirst().

If all renderings of app_label used title(), this would resolve the problem, and it would be a very simple alternative solution to ticket https://code.djangoproject.com/ticket/3591.
"	New feature	closed	contrib.admin	dev	Normal	duplicate			Unreviewed	0	0	0	0	1	0
