def get_context_data(self, **kwargs):
context = super(EventDetailView, self).get_context_data(**kwargs)
context.update(self.extra_context)
if self.object.is_archived():
self.template_name = 'happenings/404.html'
elif self.object.event_type == 'current exhibition' and self.object.end_date() < datetime.datetime.today():
self.template_name = 'happenings/detail/past-exhibition.html'
elif self.object.parent is not None:
self.template_name = 'happenings/detail/child.html'
elif self.object.child_events.all():
self.template_name = 'happenings/detail/parent.html'
else:
self.template_name = 'happenings/detail/%s.html' % slugify(self.object.event_type)
return context
评论列表
文章目录