def get_context_data(self, **kwargs):
context = super(LinkDetail, self).get_context_data(**kwargs)
if self.request.user.is_authenticated():
is_fav = self.request.user.favourites.filter(
id=self.object.id
).exists()
context['favourite'] = is_fav
context['not_lighthouse_link'] = self.object.id not in [1, 2]
if self.object.description is not None:
html = markdown.markdown(self.object.description)
context['html_description'] = html
else:
context['html_description'] = ''
return context
评论列表
文章目录