def get_context_data(self, *args, **kwargs):
        kwargs = super().get_context_data(*args, **kwargs)
        kwargs.update({
            'review':
            self.review,
            'can_approve_review':
            perms.user_can_approve_review(self.request.user, self.review),
            'can_open_close_review':
            perms.user_can_close_or_reopen_review(self.request.user,
                                                  self.review),
            'can_edit_review':
            perms.user_can_edit_review(self.request.user, self.review),
            'is_registrar':
            perms.user_is_registrar(self.request.user)
        })
        if hasattr(self, "active_tab_name"):
            kwargs['active_tab'] = self.active_tab_name

        if self.review.concepts.count() == 1:
            # It's for a single item review, display in breadcrumbs
            kwargs.update({
                'single_item_review': True,
                'item_under_review': self.review.concepts.first()
            })
        return kwargs
 def get_context_data(self, *args, **kwargs):
     # Call the base implementation first to get a context
     context = super().get_context_data(*args, **kwargs)
     # context['next'] = self.request.GET.get('next', reverse('aristotle_reviews:userReadyForReview'))
     review = self.get_review()
     context[
         'can_accept_review'] = review.status == models.REVIEW_STATES.open and perms.user_can_approve_review(
             self.request.user, self.get_review())
     return context
 def get_context_data(self, *args, **kwargs):
     kwargs = super().get_context_data(*args, **kwargs)
     kwargs['review'] = self.review
     kwargs['can_approve_review'] = perms.user_can_approve_review(self.request.user, self.review)
     kwargs['can_open_close_review'] = perms.user_can_close_or_reopen_review(self.request.user, self.review)
     kwargs['can_edit_review'] = perms.user_can_edit_review(self.request.user, self.review)
     if hasattr(self, "active_tab_name"):
         kwargs['active_tab'] = self.active_tab_name
     return kwargs
 def get_context_data(self, *args, **kwargs):
     kwargs = super().get_context_data(*args, **kwargs)
     review = self.get_review()
     kwargs['review'] = review
     kwargs['can_approve_review'] = perms.user_can_approve_review(self.request.user, review)
     kwargs['can_open_close_review'] = perms.user_can_close_or_reopen_review(self.request.user, review)
     if hasattr(self, "active_tab_name"):
         kwargs['active_tab'] = self.active_tab_name
     return kwargs
    def dispatch(self, request, *args, **kwargs):

        review = self.get_review()

        if not self.ra_active_check(review):
            raise Http404

        if not perms.user_can_approve_review(self.request.user, review):
            raise PermissionDenied
        if review.status != models.REVIEW_STATES.open:
            messages.add_message(self.request, messages.WARNING, "This review is already closed. Re-open this review to endorse content.")
            return HttpResponseRedirect(reverse('aristotle_reviews:review_details', args=[review.pk]))

        return super().dispatch(request, *args, **kwargs)
    def dispatch(self, request, *args, **kwargs):

        review = self.get_review()

        if not self.ra_active_check(review):
            return HttpResponseNotFound('Registration Authority is not active')

        if not perms.user_can_approve_review(self.request.user, review):
            raise PermissionDenied
        if review.status != models.REVIEW_STATES.open:
            messages.add_message(self.request, messages.WARNING, "This review is already closed. Re-open this review to endorse content.")
            return HttpResponseRedirect(reverse('aristotle_reviews:review_details', args=[review.pk]))

        return super().dispatch(request, *args, **kwargs)
 def get_context_data(self, *args, **kwargs):
     # Call the base implementation first to get a context
     context = super().get_context_data(*args, **kwargs)
     # context['next'] = self.request.GET.get('next', reverse('aristotle_reviews:userReadyForReview'))
     review = self.get_review()
     context['can_accept_review'] = review.status == models.REVIEW_STATES.open and perms.user_can_approve_review(self.request.user, self.get_review())
     return context