update script to be more percise to reduce memory usage
authorKarmaworld <djkarma@www.finalsclub.org>
Tue, 18 Mar 2014 21:09:06 +0000 (21:09 +0000)
committerKarmaworld <djkarma@www.finalsclub.org>
Tue, 18 Mar 2014 21:09:06 +0000 (21:09 +0000)
karmaworld/apps/notes/management/commands/convert_notes_to_markdown.py

index 3ab4648f097d87036ab0553d6b561eb580724c56..1472ab03d16fe2fa99e52df0ada8dc71f7cf9d2f 100644 (file)
@@ -15,8 +15,7 @@ class Command(BaseCommand):
 
     def handle(self, *args, **kwargs):
         """ On all calls, clean all notes with html and not text using html2text """
-        notes = Note.objects.all()
-
+        notes = Note.objects.only('static_html', 'mimetype', 'slug').filter(static_html=True).iterator()
         converted_notes = 0
         for note in notes:
             if note.static_html and not note.is_pdf():