Commit e88c384e authored by fred's avatar fred

don't create absence form if there is no fix schedule

parent 407871d3
......@@ -72,11 +72,12 @@ class EmissionDetailView(DetailView):
def get_context_data(self, **kwargs):
context = super(EmissionDetailView, self).get_context_data(**kwargs)
context['add_schedule_form'] = ScheduleForm(initial={'emission': self.object})
context['add_absence_form'] = AbsenceForm(
initial={'emission': self.object, 'user': self.request.user})
context['schedules'] = Schedule.objects.select_related().filter(
emission=self.object).order_by('datetime')
context['add_schedule_form'] = ScheduleForm(initial={'emission': self.object})
if context['schedules']:
context['add_absence_form'] = AbsenceForm(
initial={'emission': self.object, 'user': self.request.user})
# get all episodes, with an additional attribute to get the date of
# their first diffusion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment