def event_types(self): et_interview = EventType.get_from_desc('Teacher Interview') et_training = EventType.get_from_desc('Teacher Training') return { 'interview': et_interview, 'training': et_training, }
def save_timeslot(self, program, slot): slot.short_description = self.cleaned_data['name'] slot.description = self.cleaned_data['description'] slot.start = self.cleaned_data['start'] slot.end = slot.start + timedelta(hours=self.cleaned_data['hours'], minutes=self.cleaned_data['minutes']) if self.cleaned_data['openclass']: slot.event_type = EventType.get_from_desc("Open Class Time Block") else: slot.event_type = EventType.get_from_desc("Class Time Block") # default event type for now slot.program = program slot.save()
def save(self, vr=None): if vr: ts = vr.timeslot ts.start = self.cleaned_data['start_time'] ts.end = self.cleaned_data['end_time'] ts.short_description = ts.description = self.cleaned_data[ 'description'] ts.save() vr.num_volunteers = self.cleaned_data['num_volunteers'] vr.program = self.program vr.save() else: ts = Event() ts.program = self.program ts.start = self.cleaned_data['start_time'] ts.end = self.cleaned_data['end_time'] ts.short_description = ts.description = self.cleaned_data[ 'description'] ts.event_type = EventType.get_from_desc('Volunteer') ts.save() vr = VolunteerRequest() vr.program = self.program vr.timeslot = ts vr.num_volunteers = self.cleaned_data['num_volunteers'] vr.save()
def save_timeslot(self, program, slot, type): slot.start = self.cleaned_data['start'] slot.end = slot.start + timedelta(hours=self.cleaned_data['hours'], minutes=self.cleaned_data['minutes']) if type == "training": slot.event_type = EventType.get_from_desc('Teacher Training') elif type == "interview": slot.event_type = EventType.get_from_desc('Teacher Interview') else: slot.event_type = EventType.get_from_desc("Class Time Block") # default event type slot.program = program slot.short_description = slot.start.strftime('%A, %B %d %Y %I:%M %p') + " to " + slot.end.strftime('%I:%M %p') slot.description = slot.short_description slot.save()
def save_timeslot(self, program, slot, type): slot.start = self.cleaned_data['start'] slot.end = slot.start + timedelta(hours=self.cleaned_data['hours'], minutes=self.cleaned_data['minutes']) if type == "training": slot.event_type = EventType.get_from_desc('Teacher Training') elif type == "interview": slot.event_type = EventType.get_from_desc('Teacher Interview') else: slot.event_type = EventType.get_from_desc( "Class Time Block") # default event type slot.program = program slot.short_description = slot.start.strftime( '%A, %B %d %Y %I:%M %p') + " to " + slot.end.strftime('%I:%M %p') slot.description = slot.short_description slot.save()
def save(self, vr=None): if vr: ts = vr.timeslot ts.start = self.cleaned_data['start_time'] ts.end = self.cleaned_data['end_time'] ts.short_description = ts.description = self.cleaned_data['description'] ts.save() vr.num_volunteers = self.cleaned_data['num_volunteers'] vr.program = self.program vr.save() else: ts = Event() ts.program = self.program ts.start = self.cleaned_data['start_time'] ts.end = self.cleaned_data['end_time'] ts.short_description = ts.description = self.cleaned_data['description'] ts.event_type = EventType.get_from_desc('Volunteer') ts.save() vr = VolunteerRequest() vr.program = self.program vr.timeslot = ts vr.num_volunteers = self.cleaned_data['num_volunteers'] vr.save()
def event_type(self): et = EventType.get_from_desc('Class Time Block') return et