Пример #1
0
 def handle(self, *args, **options):
     for judge_id in options['judge_id']:
         try:
             AndrewIDs.objects.get(andrewId = judge_id)
             self.stdout.write('-- Judge ID: ' + judge_id + ' already exists')
         except ObjectDoesNotExist:
             judge = AndrewIDs(andrewId = judge_id, is_judge = True)
             judge.save()
             self.stdout.write('-- Judge ID: ' + judge_id + ' added')
     self.stdout.write('Judge ID scan complete')
Пример #2
0
 def handle(self, *args, **options):
     for andrew_id in options['judge_id']:
         try:
             AndrewIDs.objects.get(andrewId = andrew_id)
             self.stdout.write('-- Audience ID: ' + andrew_id + ' already exists')
         except ObjectDoesNotExist:
             audience = AndrewIDs(andrewId = andrew_id)
             audience.save()
             self.stdout.write('-- Audience ID: ' + andrew_id + ' added')
     self.stdout.write('Judge ID scan complete')
Пример #3
0
 def handle(self, **options):
     txt_file = open("VotingPlatform/andrewids.txt", "r")
     andrew_ids = txt_file.readlines()
     for andrewid in andrew_ids:
         andrew_id = andrewid[0:-1]
         try:
             AndrewIDs.objects.get(andrewId=str(andrew_id))
             self.stdout.write("-- andrew ID: " + str(andrew_id) + " already exists")
         except ObjectDoesNotExist:
             aid = AndrewIDs(andrewId=str(andrew_id))
             aid.save()
             self.stdout.write("-- Audience andrew ID: " + str(andrew_id) + " added")
     self.stdout.write("-- andrew IDs scan complete")
Пример #4
0
def add_andrewids(request):
    txt_file = request.FILES['andrewids']
    andrew_ids = txt_file.readlines()
    mes = []
    for andrewid in andrew_ids:
        andrew_id = andrewid[0:-1]
        try:
            AndrewIDs.objects.get(andrewId = andrew_id)
            mes.append('-- Audience andrew ID: '+ str(andrew_id) + ' already exists')
        except ObjectDoesNotExist:
            aid = AndrewIDs(andrewId = andrew_id)
            aid.save()
            mes.append('-- Audience andrew ID: ' + str(andrew_id) + ' added')
    return render(request,'mes.html',{'messages': mes})