diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index 1345eaf..abad884 100644
a
|
b
|
import os
|
2 | 2 | import sys |
3 | 3 | from optparse import OptionParser, NO_DEFAULT |
4 | 4 | import imp |
| 5 | from collections import defaultdict |
5 | 6 | |
6 | 7 | import django |
7 | 8 | from django.core.management.base import BaseCommand, CommandError, handle_default_options |
… |
… |
class ManagementUtility(object):
|
233 | 234 | def main_help_text(self): |
234 | 235 | """ |
235 | 236 | Returns the script's main help text, as a string. |
236 | | """ |
| 237 | """ |
| 238 | from django.core.management.commands.startapp import ProjectCommand |
237 | 239 | usage = ['',"Type '%s help <subcommand>' for help on a specific subcommand." % self.prog_name,''] |
238 | 240 | usage.append('Available subcommands:') |
239 | | commands = get_commands().keys() |
240 | | commands.sort() |
241 | | for cmd in commands: |
242 | | usage.append(' %s' % cmd) |
| 241 | |
| 242 | apps_to_commands = defaultdict(lambda: []) |
| 243 | for command, app in get_commands().items(): |
| 244 | # 'startapp' command is mapped to ProjectCommand |
| 245 | # instead of 'django.core'. |
| 246 | if isinstance(app, ProjectCommand): |
| 247 | app = 'django.core' |
| 248 | apps_to_commands[app].append(command) |
| 249 | |
| 250 | for app in sorted(apps_to_commands.keys()): |
| 251 | usage.append("%s:" % app) |
| 252 | for command in sorted(apps_to_commands[app]): |
| 253 | usage.append("\t%s" % command) |
| 254 | usage.append("") # Extra newline separaing apps. |
| 255 | |
243 | 256 | return '\n'.join(usage) |
244 | 257 | |
245 | 258 | def fetch_command(self, subcommand): |