def post(self, request, event): form = ScheduleReleaseForm(self.request.POST) form.is_valid() if self.request.event.schedules.filter(version=form.cleaned_data['version']).exists(): messages.error(self.request, _('Please use a version number you did not use yet!')) else: self.request.event.release_schedule(form.cleaned_data['version'], user=request.user) messages.success(self.request, _('Nice, your schedule has been released!')) return redirect(self.request.event.orga_urls.schedule)
def get_context_data(self, event): ctx = super().get_context_data() version = self.request.GET.get('version') ctx['schedule_version'] = version ctx['active_schedule'] = self.request.event.schedules.filter(version=version).first() if version else self.request.event.wip_schedule ctx['release_form'] = ScheduleReleaseForm() return ctx
def get_context_data(self, event): ctx = super().get_context_data() ctx['schedule_version'] = self.request.GET.get('version') ctx['release_form'] = ScheduleReleaseForm() return ctx