add command to sync the iri file, recreating them if necessary
authorymh <ymh.work@gmail.com>
Tue, 22 Jan 2013 13:03:10 +0100
changeset 1077 94cca4093b60
parent 1075 66c7a0826bd7
child 1078 15dafb5ba550
add command to sync the iri file, recreating them if necessary
.settings/org.eclipse.core.resources.prefs
src/ldt/ldt/management/commands/synciri.py
--- a/.settings/org.eclipse.core.resources.prefs	Tue Jan 22 11:25:55 2013 +0100
+++ b/.settings/org.eclipse.core.resources.prefs	Tue Jan 22 13:03:10 2013 +0100
@@ -34,6 +34,7 @@
 encoding//src/ldt/ldt/ldt_utils/migrations/0024_auto__chg_field_tag_name.py=utf-8
 encoding//src/ldt/ldt/ldt_utils/migrations/0025_chg_site_domain.py=utf-8
 encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8
+encoding//src/ldt/ldt/management/commands/synciri.py=utf-8
 encoding//src/ldt/ldt/management/utils.py=utf-8
 encoding//src/ldt/ldt/test/test_runner.py=utf-8
 encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/management/commands/synciri.py	Tue Jan 22 13:03:10 2013 +0100
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+'''
+Created on Jan 22, 2013
+
+@author: ymh
+'''
+
+from django.core.management.base import NoArgsCommand
+from ..utils import show_progress
+from ldt.ldt_utils.models import Content
+
+class Command(NoArgsCommand):
+    
+    def handle_noargs(self, **options):
+        
+        content_list = list(Content.objects.all())
+        writer = None
+        for i,c in enumerate(content_list):
+            writer = show_progress(i+1, len(content_list), "Processing content %s" % c.title, 80, writer)
+            c.sync_iri_file()
+        
\ No newline at end of file