Exemplo n.º 1
0
 def get_context_data(self, **kwargs):
     context = super(PublicationDisplay, self).get_context_data(**kwargs)
     # adding comment to the view, better order by
     context['comments'] = Comment.objects.filter(
         publication=self.kwargs["pk"]).order_by('validated',
                                                 '-comment_type',
                                                 'corrected',
                                                 '-seriousness',
                                                 'creation_date')
     # put the initial licence as the licence of the publication
     try:
         context['is_editor'] = self.get_is_editor(
             context["publication_detail"].editor)
         context['is_reviewer'] = self.get_is_reviewer()
         context['evaluated'] = self.get_evaluated()
         if context['is_reviewer']:
             context['reviewer_registration'] = reviewer_action(
                 self.request.user, self.kwargs["pk"], "leave")
         else:
             context['reviewer_registration'] = reviewer_action(
                 self.request.user, self.kwargs["pk"], "become")
     except KeyError:
         context['is_editor'] = False
         context['is_reviewer'] = False
         context['evaluated'] = False
     context['constants'] = CONSTANTS_TEMPLATE
     context['order'] = PUBLICATION
     context['alert'] = self.get_alert_status(context)
     context['form_comment'] = CommentForm()
     context['form_eif'] = EstimatedImpactFactorForm()
     return context
Exemplo n.º 2
0
 def get_context_data(self, *args, **kwargs):
     context = super(PublicationDetailView,
                     self).get_context_data(*args, **kwargs)
     publication = Publication.objects.get(
         slug=self.kwargs.get('page_alias'))
     context['form'] = CommentForm()
     context['comments'] = Comment.objects.filter(publication=publication)
     context['user'] = self.request.user
     return context