diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-25 18:53:18 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2008-08-25 18:53:18 +0000 |
| commit | 7e06b69a3d1e1cdfef625bdf96f97ca5eb0eed74 (patch) | |
| tree | 5726b0c6e27e8cd0be1324e2ca4bd4b0d6503822 /django | |
| parent | ab7eabfcd1bdc51c15bf66e39ad389add4fc676d (diff) | |
Removed outdated "adminindex" command -- the same behavior is now far easier and better done in a template, or perhaps a custom `AdminSite.index` function. Refs #5500.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8548 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/commands/adminindex.py | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/django/core/management/commands/adminindex.py b/django/core/management/commands/adminindex.py deleted file mode 100644 index 4f389136ca..0000000000 --- a/django/core/management/commands/adminindex.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.core.management.base import AppCommand -from django.utils.encoding import force_unicode -from django.utils.text import capfirst - -MODULE_TEMPLATE = ''' {%% if perms.%(app)s.%(addperm)s or perms.%(app)s.%(changeperm)s %%} - <tr> - <th>{%% if perms.%(app)s.%(changeperm)s %%}<a href="%(app)s/%(mod)s/">{%% endif %%}%(name)s{%% if perms.%(app)s.%(changeperm)s %%}</a>{%% endif %%}</th> - <td class="x50">{%% if perms.%(app)s.%(addperm)s %%}<a href="%(app)s/%(mod)s/add/" class="addlink">{%% endif %%}Add{%% if perms.%(app)s.%(addperm)s %%}</a>{%% endif %%}</td> - <td class="x75">{%% if perms.%(app)s.%(changeperm)s %%}<a href="%(app)s/%(mod)s/" class="changelink">{%% endif %%}Change{%% if perms.%(app)s.%(changeperm)s %%}</a>{%% endif %%}</td> - </tr> - {%% endif %%}''' - -class Command(AppCommand): - help = 'Prints the admin-index template snippet for the given app name(s).' - - def handle_app(self, app, **options): - from django.db.models import get_models - output = [] - app_models = get_models(app) - app_label = app_models[0]._meta.app_label - output.append('{%% if perms.%s %%}' % app_label) - output.append('<div class="module"><h2>%s</h2><table>' % app_label.title()) - for model in app_models: - if model._meta.admin: - output.append(MODULE_TEMPLATE % { - 'app': app_label, - 'mod': model._meta.module_name, - 'name': force_unicode(capfirst(model._meta.verbose_name_plural)), - 'addperm': model._meta.get_add_permission(), - 'changeperm': model._meta.get_change_permission(), - }) - output.append('</table></div>') - output.append('{% endif %}') - return '\n'.join(output) |
