示例#1
0
def invite_list(request,eventId):
    event = get_object_or_404(Event,pk=eventId)

    new_person = EventAttendancePerson()
    new_person.event = event
    new_person_form = NewEventPersonForm(instance=new_person)

    invite_list = event.eventattendanceperson_set.all()

    student_sunets = StandardStudentCSVProcessor.getStudentSunetIDs()

    student_annotated = []
    for student in invite_list:
        recognized = False
        if student.sunetid in student_sunets:
            recognized = True
        student_annotated.append((student,recognized))

    flag = ""
    if request.GET.get('flag'):
        flag = request.GET.get('flag')

    return render_to_response('scanner/manage/invite_list.html',{
        'event': event,
        'new_person_form': new_person_form,
        'invite_list': student_annotated,
        'flag': flag,
        },
        context_instance=RequestContext(request))
示例#2
0
    def clean_sunets(self):
        sunetBlock = str(self.cleaned_data.get('sunets'))

        student_sunets = StandardStudentCSVProcessor.getStudentSunetIDs()

        errors = []
        sunets = []

        lines = sunetBlock.splitlines()
        for line in lines:
            individuals = line.split(',')

            for individual in individuals:
                individual = individual.lower().strip()
                individual = individual.replace("@stanford.edu","")
                if not self.sunet_is_valid_form(individual):
                    errors.append('%s is not proper form for a SUNetID' % individual)
                    continue
                if individual not in student_sunets:
                    errors.append('%s is not recognized as a SUNetID' % individual)
                    continue
                sunets.append(individual)

                # for now
#        ignore = self.cleaned_data.get('ignore')
#        print ignore
#        print "LOLOL"
#        if len(errors) > 0 and not ignore:
#            raise forms.ValidationError(errors)
        return sunets