From 593567aec6b25ee1140a83e4017c707bc13c92f8 Mon Sep 17 00:00:00 2001 From: Karmaworld Date: Tue, 18 Mar 2014 21:09:06 +0000 Subject: [PATCH] update script to be more percise to reduce memory usage --- .../notes/management/commands/convert_notes_to_markdown.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/karmaworld/apps/notes/management/commands/convert_notes_to_markdown.py b/karmaworld/apps/notes/management/commands/convert_notes_to_markdown.py index 3ab4648..1472ab0 100644 --- a/karmaworld/apps/notes/management/commands/convert_notes_to_markdown.py +++ b/karmaworld/apps/notes/management/commands/convert_notes_to_markdown.py @@ -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(): -- 2.25.1