feedback/management/commands/ch_ip.py
author nishanth
Mon, 26 Apr 2010 07:48:53 +0530
changeset 55 8d78e1e62424
parent 53 8cc852e205aa
permissions -rw-r--r--
changed the way time_left is displayed
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()