Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 7e06b69a3d1e1cdfef625bdf96f97ca5eb0eed74 1 parent ab7eabf
Jacob Kaplan-Moss authored August 25, 2008
34  django/core/management/commands/adminindex.py
... ...
@@ -1,34 +0,0 @@
1  
-from django.core.management.base import AppCommand
2  
-from django.utils.encoding import force_unicode
3  
-from django.utils.text import capfirst
4  
-
5  
-MODULE_TEMPLATE = '''    {%% if perms.%(app)s.%(addperm)s or perms.%(app)s.%(changeperm)s %%}
6  
-    <tr>
7  
-        <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>
8  
-        <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>
9  
-        <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>
10  
-    </tr>
11  
-    {%% endif %%}'''
12  
-
13  
-class Command(AppCommand):
14  
-    help = 'Prints the admin-index template snippet for the given app name(s).'
15  
-
16  
-    def handle_app(self, app, **options):
17  
-        from django.db.models import get_models
18  
-        output = []
19  
-        app_models = get_models(app)
20  
-        app_label = app_models[0]._meta.app_label
21  
-        output.append('{%% if perms.%s %%}' % app_label)
22  
-        output.append('<div class="module"><h2>%s</h2><table>' % app_label.title())
23  
-        for model in app_models:
24  
-            if model._meta.admin:
25  
-                output.append(MODULE_TEMPLATE % {
26  
-                    'app': app_label,
27  
-                    'mod': model._meta.module_name,
28  
-                    'name': force_unicode(capfirst(model._meta.verbose_name_plural)),
29  
-                    'addperm': model._meta.get_add_permission(),
30  
-                    'changeperm': model._meta.get_change_permission(),
31  
-                })
32  
-        output.append('</table></div>')
33  
-        output.append('{% endif %}')
34  
-        return '\n'.join(output)
4  docs/intro/tutorial02.txt
@@ -449,9 +449,5 @@ uses a template variable called ``app_list``. That variable contains every
449 449
 installed Django app. Instead of using that, you can hard-code links to
450 450
 object-specific admin pages in whatever way you think is best.
451 451
 
452  
-Django offers another shortcut in this department. Run the command ``python
453  
-manage.py adminindex polls`` to get a chunk of template code for inclusion in
454  
-the admin index template. It's a useful starting point.
455  
-
456 452
 When you're comfortable with the admin site, read :ref:`part 3 of this tutorial
457 453
 <intro-tutorial03>` to start working on public poll views.
3  docs/man/django-admin.1
@@ -18,9 +18,6 @@ script found at the top level of each Django project directory.
18 18
 .sp
19 19
 .SH "ACTIONS"
20 20
 .TP
21  
-.BI "adminindex [" "appname ..." "]"
22  
-Prints the admin\-index template snippet for the given app name(s).
23  
-.TP
24 21
 .BI cleanup
25 22
 Cleans out old data from the database (only expired sessions at the moment).
26 23
 .TP
11  docs/ref/django-admin.txt
@@ -95,17 +95,6 @@ that ``django-admin.py`` should print to the console.
95 95
 Available subcommands
96 96
 =====================
97 97
 
98  
-adminindex
99  
-----------
100  
-
101  
-.. django-admin:: adminindex <appname appname ...>
102  
-
103  
-Prints the admin-index template snippet for the given app name(s).
104  
-
105  
-Use admin-index template snippets if you want to customize the look and feel of
106  
-your admin's index page. See :ref:`Tutorial 2 <intro-tutorial02>` for more
107  
-information.
108  
-
109 98
 cleanup 
110 99
 -------
111 100
 
4  extras/django_bash_completion
@@ -44,7 +44,7 @@ _django_completion()
44 44
     # Standalone options
45 45
     opts="--help --settings --pythonpath --noinput --noreload --format --indent --verbosity --adminmedia --version --locale --domain"
46 46
     # Actions
47  
-    actions="adminindex createcachetable createsuperuser compilemessages \
  47
+    actions="createcachetable createsuperuser compilemessages \
48 48
              dbshell diffsettings dumpdata flush inspectdb loaddata \
49 49
              makemessages reset runfcgi runserver shell sql sqlall sqlclear \
50 50
              sqlcustom sqlflush sqlindexes sqlreset sqlsequencereset startapp \
@@ -90,7 +90,7 @@ _django_completion()
90 90
         esac
91 91
     else
92 92
         case ${prev} in
93  
-            adminindex|dumpdata|reset| \
  93
+            dumpdata|reset| \
94 94
             sql|sqlall|sqlclear|sqlcustom|sqlindexes| \
95 95
             sqlreset|sqlsequencereset|test)
96 96
                 # App completion

0 notes on commit 7e06b69

Please sign in to comment.
Something went wrong with that request. Please try again.