feedback/management/commands/ch_ip.py
author nishanth
Fri, 23 Apr 2010 12:27:19 +0530
changeset 53 8cc852e205aa
permissions -rw-r--r--
added a ch_ip management command that sets IP of all the quizzes to null
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     1
from django.core.management.base import NoArgsCommand
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     2
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     3
from offline.quiz.models import Quiz
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     4
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     5
def seed_db():
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     6
   """ set ip of all the previous quizzes to null.
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     7
   """
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     8
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
     9
   for q in Quiz.objects.all():
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    10
       q.user_ip = ""
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    11
       q.save()
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    12
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    13
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    14
class Command(NoArgsCommand):
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    15
    
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    16
    def handle_noargs(self, **options):
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    17
        """ Just copied the code from seed_db.py """
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    18
        
8cc852e205aa added a ch_ip management command that sets IP of all the quizzes to null
nishanth
parents:
diff changeset
    19
        seed_db()