From 7e06b69a3d1e1cdfef625bdf96f97ca5eb0eed74 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Mon, 25 Aug 2008 18:53:18 +0000 Subject: [PATCH] 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 --- django/core/management/commands/adminindex.py | 34 ------------------- docs/intro/tutorial02.txt | 4 --- docs/man/django-admin.1 | 3 -- docs/ref/django-admin.txt | 11 ------ extras/django_bash_completion | 4 +-- 5 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 django/core/management/commands/adminindex.py 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 %%} - - {%% if perms.%(app)s.%(changeperm)s %%}{%% endif %%}%(name)s{%% if perms.%(app)s.%(changeperm)s %%}{%% endif %%} - {%% if perms.%(app)s.%(addperm)s %%}{%% endif %%}Add{%% if perms.%(app)s.%(addperm)s %%}{%% endif %%} - {%% if perms.%(app)s.%(changeperm)s %%}{%% endif %%}Change{%% if perms.%(app)s.%(changeperm)s %%}{%% endif %%} - - {%% 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('

%s

' % 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('
') - output.append('{% endif %}') - return '\n'.join(output) diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index 4af08c48af..ffc95952f6 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -449,9 +449,5 @@ uses a template variable called ``app_list``. That variable contains every installed Django app. Instead of using that, you can hard-code links to object-specific admin pages in whatever way you think is best. -Django offers another shortcut in this department. Run the command ``python -manage.py adminindex polls`` to get a chunk of template code for inclusion in -the admin index template. It's a useful starting point. - When you're comfortable with the admin site, read :ref:`part 3 of this tutorial ` to start working on public poll views. diff --git a/docs/man/django-admin.1 b/docs/man/django-admin.1 index 6b58c9183b..7f65fd0644 100644 --- a/docs/man/django-admin.1 +++ b/docs/man/django-admin.1 @@ -18,9 +18,6 @@ script found at the top level of each Django project directory. .sp .SH "ACTIONS" .TP -.BI "adminindex [" "appname ..." "]" -Prints the admin\-index template snippet for the given app name(s). -.TP .BI cleanup Cleans out old data from the database (only expired sessions at the moment). .TP diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt index d6cb4e62f3..f9c3fe7ee7 100644 --- a/docs/ref/django-admin.txt +++ b/docs/ref/django-admin.txt @@ -95,17 +95,6 @@ that ``django-admin.py`` should print to the console. Available subcommands ===================== -adminindex ----------- - -.. django-admin:: adminindex - -Prints the admin-index template snippet for the given app name(s). - -Use admin-index template snippets if you want to customize the look and feel of -your admin's index page. See :ref:`Tutorial 2 ` for more -information. - cleanup ------- diff --git a/extras/django_bash_completion b/extras/django_bash_completion index affb43a763..b805af9e6f 100755 --- a/extras/django_bash_completion +++ b/extras/django_bash_completion @@ -44,7 +44,7 @@ _django_completion() # Standalone options opts="--help --settings --pythonpath --noinput --noreload --format --indent --verbosity --adminmedia --version --locale --domain" # Actions - actions="adminindex createcachetable createsuperuser compilemessages \ + actions="createcachetable createsuperuser compilemessages \ dbshell diffsettings dumpdata flush inspectdb loaddata \ makemessages reset runfcgi runserver shell sql sqlall sqlclear \ sqlcustom sqlflush sqlindexes sqlreset sqlsequencereset startapp \ @@ -90,7 +90,7 @@ _django_completion() esac else case ${prev} in - adminindex|dumpdata|reset| \ + dumpdata|reset| \ sql|sqlall|sqlclear|sqlcustom|sqlindexes| \ sqlreset|sqlsequencereset|test) # App completion