def make_post_response(self, request, response=None, errorcontext=None): if response and hasattr(response, 'occurrence'): show_scheduling_occurrence_status(request, response, self.__class__.__name__) return HttpResponseRedirect(self.success_url) return super(EditVolunteerView, self).make_post_response(request, response, errorcontext)
def make_post_response(self, request, response=None, errorcontext=None): if response: show_scheduling_occurrence_status(request, response, self.__class__.__name__) if response and response.occurrence: return HttpResponseRedirect(self.success_url) else: return render(request, self.template, self.make_context(request, errorcontext))
def finish_booking(self, request, response, day_pk): show_scheduling_occurrence_status(request, response, self.__class__.__name__) if response.occurrence: return HttpResponseRedirect("%s?%s-day=%d&filter=Filter&new=%s" % ( reverse('manage_event_list', urlconf='gbe.scheduling.urls', args=[self.conference.conference_slug]), self.conference.conference_slug, day_pk, str([response.occurrence.pk]), ))
def copy_events_from_form(self, request): form = self.make_event_picker(request, timedelta(0)) new_root = None if form.is_valid(): copied_ids = [] alt_id = None if form.cleaned_data['copy_mode'] == "copy_children_only": (new_root, target_day, delta, conference) = self.get_child_copy_settings(form) elif form.cleaned_data['copy_mode'] == "include_parent": target_day = form.cleaned_data['copy_to_day'] delta = target_day.day - self.start_day conference = form.cleaned_data['copy_to_day'].conference new_root = self.copy_root( request, delta, form.cleaned_data['copy_to_day'].conference) if new_root and new_root.__class__.__name__ == "Event": copied_ids += [new_root.pk] else: alt_id = new_root.pk for sub_event_id in form.cleaned_data["copied_event"]: response = get_occurrence(sub_event_id) response = self.copy_event( response.occurrence, delta, conference, new_root) show_scheduling_occurrence_status( request, response, self.__class__.__name__) if response.occurrence: copied_ids += [response.occurrence.pk] url = "%s?%s-day=%d&filter=Filter" % ( reverse('manage_event_list', urlconf='gbe.scheduling.urls', args=[conference.conference_slug]), conference.conference_slug, target_day.pk) if len(copied_ids) > 0: url += "&new=%s" % str(copied_ids) if alt_id: url += "&alt_id=%s" % alt_id return HttpResponseRedirect(url) else: context = self.make_context(request, post=request.POST) make_copy, context = self.validate_and_proceed(request, context) context['second_form'] = form return render(request, self.template, context)
def copy_root(self, request, delta, conference): new_occurrence = None response = self.copy_event( self.occurrence, delta, conference) show_scheduling_occurrence_status( request, response, self.__class__.__name__) if response.occurrence: new_occurrence = response.occurrence return new_occurrence
def finish_booking(self, request, response, day_pk): show_scheduling_occurrence_status( request, response, self.__class__.__name__) if response.occurrence: return HttpResponseRedirect( "%s?%s-day=%d&filter=Filter&new=%s" % ( reverse('manage_event_list', urlconf='gbe.scheduling.urls', args=[self.conference.conference_slug]), self.conference.conference_slug, day_pk, str([response.occurrence.pk]),))
def copy_solo(self, request, context): delta = None parent_event_id = None copy_mode = context['copy_solo_mode'].cleaned_data['copy_mode'] if copy_mode_solo_choices[2][0] in copy_mode: target_day = context['copy_solo_mode'].cleaned_data['copy_to_day'] conference = target_day.conference delta = target_day.day - self.start_day if copy_mode_solo_choices[0][0] in copy_mode: parent_event_id = context['copy_solo_mode'].cleaned_data[ 'target_event'] resp = get_occurrence( context['copy_solo_mode'].cleaned_data['target_event']) if delta is None: delta = resp.occurrence.starttime.date() - self.start_day conference = resp.occurrence.eventitem.event.e_conference labels = [ conference.conference_slug, self.occurrence.as_subtype.calendar_type ] if copy_mode_solo_choices[1][0] in copy_mode: labels += [context['copy_solo_mode'].cleaned_data['area'].slug] response = self.copy_event( self.occurrence, delta, conference, context['copy_solo_mode'].cleaned_data['room'], labels, parent_event_id=parent_event_id, set_room=True) show_scheduling_occurrence_status(request, response, self.__class__.__name__) if response.occurrence: target_day = ConferenceDay.objects.filter( day=response.occurrence.starttime.date(), conference=response.occurrence.eventitem.event.e_conference ).first() return HttpResponseRedirect("%s?%s-day=%d&filter=Filter&new=%s" % ( reverse('manage_event_list', urlconf='gbe.scheduling.urls', args=[conference.conference_slug]), conference.conference_slug, target_day.pk, str([response.occurrence.pk]), ))
def make_post_response(self, request, response=None, errorcontext=None): if response: show_scheduling_occurrence_status( request, response, self.__class__.__name__) if response and response.occurrence: return HttpResponseRedirect(self.success_url) else: return render(request, self.template, self.make_context(request, errorcontext))
def copy_root(self, request, delta, conference, room): new_occurrence = None labels = [ conference.conference_slug, self.occurrence.as_subtype.calendar_type ] for area in StaffArea.objects.filter(conference=conference, slug__in=self.occurrence.labels): labels += [area.slug] response = self.copy_event(self.occurrence, delta, conference, room, labels, set_room=True) show_scheduling_occurrence_status(request, response, self.__class__.__name__) if response.occurrence: new_occurrence = response.occurrence return new_occurrence
def post(self, request, *args, **kwargs): error = self.groundwork(request, args, kwargs) if error: return error context = {} if 'pick_mode' in request.POST.keys(): context = self.make_context(request, post=request.POST) make_copy, context = self.validate_and_proceed(request, context) if make_copy: target_day = context['pick_day'].cleaned_data[ 'copy_to_day'] delta = target_day.day - self.start_day response = self.copy_event( self.occurrence, delta, target_day.conference) show_scheduling_occurrence_status( request, response, self.__class__.__name__) if response.occurrence: slug = target_day.conference.conference_slug return HttpResponseRedirect( "%s?%s-day=%d&filter=Filter&new=%s" % ( reverse('manage_event_list', urlconf='gbe.scheduling.urls', args=[slug]), slug, target_day.pk, str([response.occurrence.pk]),)) if 'pick_event' in request.POST.keys(): return self.copy_events_from_form(request) return render( request, self.template, context)