added a ch_ip management command that sets IP of all the quizzes to null
authornishanth
Fri, 23 Apr 2010 12:27:19 +0530
changeset 53 8cc852e205aa
parent 52 adab2d07981a
child 54 49ef0f046ec5
added a ch_ip management command that sets IP of all the quizzes to null
feedback/management/__init__.py
feedback/management/commands/__init__.py
feedback/management/commands/ch_ip.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/feedback/management/commands/ch_ip.py	Fri Apr 23 12:27:19 2010 +0530
@@ -0,0 +1,19 @@
+from django.core.management.base import NoArgsCommand
+
+from offline.quiz.models import Quiz
+
+def seed_db():
+   """ set ip of all the previous quizzes to null.
+   """
+
+   for q in Quiz.objects.all():
+       q.user_ip = ""
+       q.save()
+
+
+class Command(NoArgsCommand):
+    
+    def handle_noargs(self, **options):
+        """ Just copied the code from seed_db.py """
+        
+        seed_db()