Skip to content
This repository
Browse code

Merge pull request #925 from ojii/feature/document-cli

Feature/document cli
  • Loading branch information...
commit 73c3665adcbbb1ba46dd997275b3bcbada65979b 2 parents 30a5ad9 + 295e74d
Chris Glass authored August 04, 2011
14  cms/management/commands/cms.py
@@ -14,12 +14,22 @@ class Command(SubcommandsCommand):
14 14
         make_option('--noinput', action='store_false', dest='interactive', default=True,
15 15
         help='Tells django-cms to NOT prompt the user for input of any kind. '),
16 16
     )
  17
+    
  18
+    args = '<subcommand>'
17 19
 
18 20
     command_name = 'cms'
19 21
     
20  
-    help = 'Various django-cms commands'
21 22
     subcommands = {
22 23
         'uninstall': UninstallCommand,
23 24
         'list': ListCommand,
24 25
         'moderator': ModeratorCommand,
25  
-    }
  26
+    }
  27
+    
  28
+    @property
  29
+    def help(self):
  30
+        lines = ['django CMS command line interface.', '', 'Available subcommands:']
  31
+        for subcommand in sorted(self.subcommands.keys()):
  32
+            lines.append('  %s' % subcommand)
  33
+        lines.append('')
  34
+        lines.append('Use `manage.py cms <subcommand> --help` for help about subcommands')
  35
+        return '\n'.join(lines)
4  cms/management/commands/subcommands/list.py
@@ -9,9 +9,9 @@ class ListApphooksCommand(NoArgsCommand):
9 9
     
10 10
     help = 'Lists all apphooks in pages'
11 11
     def handle_noargs(self, **options):
12  
-        urls = Title.objects.values_list("application_urls", flat=True)
  12
+        urls = Title.objects.filter(application_urls__gt='').values_list("application_urls", flat=True)
13 13
         for url in urls:
14  
-            self.stdout.write(url+'\n')
  14
+            self.stdout.write('%s\n' % url)
15 15
             
16 16
 class ListPluginsCommand(NoArgsCommand):
17 17
 
74  docs/advanced/cli.rst
Source Rendered
... ...
@@ -0,0 +1,74 @@
  1
+######################
  2
+Command Line Interface
  3
+######################
  4
+
  5
+.. highlight:: bash
  6
+
  7
+You can invoke the django CMS command line interface using the ``cms`` Django
  8
+command::
  9
+
  10
+    python manage.py cms
  11
+
  12
+**********************
  13
+Informational commands
  14
+**********************
  15
+
  16
+.. _cms-list-command:
  17
+
  18
+``cms list``
  19
+============
  20
+
  21
+The ``list`` command is used to display information about your installation.
  22
+
  23
+It has two subcommands:
  24
+
  25
+* ``cms list plugins`` lists all plugins that are used in your project.
  26
+* ``cms list apphooks`` lists all apphooks that are used in your project.
  27
+
  28
+
  29
+**************************************
  30
+Plugin and apphook management commands
  31
+**************************************
  32
+
  33
+``cms uninstall``
  34
+=================
  35
+
  36
+The ``uninstall`` subcommand can be used to make an uninstallation of a CMS
  37
+Plugin or an apphook easier.
  38
+
  39
+It has two subcommands:
  40
+
  41
+* ``cms uninstall plugins <plugin name> [<plugin name 2> [...]]`` uninstalls
  42
+  one or several plugins by **removing** them from all pages where they are
  43
+  used. Note that the plugin name should be the name of the class that is
  44
+  registered to the django CMS. If you are unsure about the plugin name, use
  45
+  the :ref:`cms-list-command` to see a list of installed plugins.
  46
+* ``cms uninstall apphooks <apphook name> [<apphook name 2> [...]]`` uninstalls
  47
+  one or several apphooks by **removing** them from all pages where they are
  48
+  used. Note that the apphook name should be the name of the class that is
  49
+  registered to the django CMS. If you are unsure about the apphook name, use
  50
+  the :ref:`cms-list-command` to see a list of installed apphook.
  51
+
  52
+.. warning::
  53
+
  54
+    The uninstall command **permanently deletes** data from your database.
  55
+    You should make a backup of your database before using them!
  56
+    
  57
+
  58
+
  59
+
  60
+******************
  61
+Moderator commands
  62
+******************
  63
+
  64
+``cms moderator``
  65
+=================
  66
+
  67
+If you turn :setting:`CMS_MODERATOR` to ``True`` on an existing project, you
  68
+should use the ``cms moderator on`` command to make the required changes in the
  69
+database, otherwise you will have problems with invisible pages.
  70
+
  71
+.. warning::
  72
+
  73
+    This command **alters data** in your database. You should make a backup of
  74
+    your database before using it!
1  docs/index.rst
Source Rendered
@@ -37,6 +37,7 @@ Advanced
37 37
     advanced/i18n
38 38
     advanced/sitemap
39 39
     advanced/templatetags
  40
+    advanced/cli
40 41
 
41 42
 
42 43
 *****************

0 notes on commit 73c3665

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