src/ldt/ldt/management/commands/reindex.py
changeset 1118 e7274a257c9d
parent 1117 3bab1e42acfa
parent 1113 927f75165e45
child 1119 f1e48630fc59
--- a/src/ldt/ldt/management/commands/reindex.py	Wed Feb 27 00:07:54 2013 +0100
+++ b/src/ldt/ldt/management/commands/reindex.py	Wed Feb 27 00:12:24 2013 +0100
@@ -16,11 +16,17 @@
                   action="store",
                   type="string",
                   help="Index only the content specified by CONTENT_ID."),
+        make_option("-n", "--nocontent",
+                  dest="no_content",
+                  action="store",
+                  type="string",
+                  help="Avoid index only the content specified by CONTENT_ID."),
         )
 
     def handle(self, *args, **options):
         content_id = options.get("content_id")
         projects = options.get("projects")
+        no_content = options.get("no_content")
         
         if content_id:
             self.stdout.write('Creating index for %s\n' % content_id)
@@ -29,9 +35,10 @@
             self.stdout.write('Creating contents index...\n')
             contentList = Content.objects.all()
         count = contentList.count()
-                    
-        indexer = ContentIndexer(contentList, callback=(lambda i,o: show_progress(i+1, count, o.title, 50)))
-        indexer.index_all()
+            
+        if not no_content;            
+            indexer = ContentIndexer(contentList, callback=(lambda i,o: show_progress(i+1, count, o.title, 50)))
+            indexer.index_all()
                     
         if projects:
             self.stdout.write('Creating projects index...\n')