def dispatch(self, request, *args, **kwargs): self.prepare(request, *args, **kwargs) if not (self.object.author == self.request.user or self.request.user.is_staff or self.request.user.is_superuser): return create_403(request) return super(DeleteCommentView, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.request = request self.args = args self.kwargs = kwargs self.object = self.get_object() if not (utils.can_participate_in_review(self.request.user, self.object) or request.user.is_staff): return create_403(request) return super(ProposalDetailsView, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.prepare(request, *args, **kwargs) if not self.object.proposal.can_be_reviewed(): messages.error(request, _("This proposal can no longer be reviewed.")) return HttpResponseRedirect(reverse('reviews-proposal-details', kwargs={'pk': self.object.proposal.pk})) if utils.is_proposal_author(request.user, self.object.proposal): return create_403(request, _("You are not allowed to review your own proposals.")) return super(DeleteReviewView, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.proposal = get_object_or_404(models.Proposal, pk=kwargs['pk']) if not utils.can_participate_in_review(request.user, self.proposal): return create_403(request) self.proposal_version = models.ProposalVersion.objects.get_latest_for( self.proposal) return super(SubmitCommentView, self).dispatch(request, *args, **kwargs)
def get(self, *args, **kwargs): self.object_list = self.get_queryset() if not (utils.can_participate_in_review(self.request.user, self.proposal) or self.request.user.is_staff): return create_403( _("You have to be the author of this proposal or a reviewer to access this page" )) return super(ProposalVersionListView, self).get(*args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.object = get_object_or_404(models.Proposal.current_conference, pk=kwargs['pk']) if not self.object.can_be_updated(): messages.error(request, _("Proposals can no longer be updated")) return HttpResponseRedirect(reverse('reviews-proposal-details', kwargs={'pk': self.object.pk})) self.proposal_version = models.ProposalVersion.objects.get_latest_for(self.object) if not utils.is_proposal_author(request.user, self.object): return create_403(_("You have to be the author of this review to access this page")) return super(UpdateProposalView, self).dispatch(request, *args, **kwargs)
def get(self, request, *args, **kwargs): self.object = self.get_object() if not (utils.can_participate_in_review(self.request.user, self.object.original) or request.user.is_staff): return create_403( _("You have to be the author of this proposal or a reviewer to access this page" )) return super(ProposalVersionDetailsView, self).get(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.proposal = get_object_or_404(models.Proposal, pk=kwargs['pk']) if utils.is_proposal_author(request.user, self.proposal): return create_403(request, _("You are not allowed to review your own proposals.")) if not self.proposal.can_be_reviewed(): messages.error(request, _("This proposal can no longer be reviewed.")) return HttpResponseRedirect(reverse('reviews-proposal-details', kwargs={'pk': self.proposal.pk})) if models.Review.objects.filter(user=request.user, proposal=self.proposal).count(): messages.info(request, _("You have already reviewed this proposal")) return HttpResponseRedirect(reverse('reviews-proposal-details', kwargs={'pk': self.proposal.pk})) self.proposal_version = models.ProposalVersion.objects.get_latest_for(self.proposal) return super(SubmitReviewView, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.prepare(request, *args, **kwargs) if not self.object.proposal.can_be_reviewed(): messages.error(request, _("This proposal can no longer be reviewed.")) return HttpResponseRedirect( reverse('reviews-proposal-details', kwargs={'pk': self.object.proposal.pk})) if utils.is_proposal_author(request.user, self.object.proposal): return create_403( request, _("You are not allowed to review your own proposals.")) return super(DeleteReviewView, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.object = get_object_or_404(models.Proposal.current_conference, pk=kwargs['pk']) if not self.object.can_be_updated(): messages.error(request, _("Proposals can no longer be updated")) return HttpResponseRedirect( reverse('reviews-proposal-details', kwargs={'pk': self.object.pk})) self.proposal_version = models.ProposalVersion.objects.get_latest_for( self.object) if not utils.is_proposal_author(request.user, self.object): return create_403( _("You have to be the author of this review in order to access this page" )) return super(UpdateProposalView, self).dispatch(request, *args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.proposal = get_object_or_404(models.Proposal, pk=kwargs['pk']) if utils.is_proposal_author(request.user, self.proposal): return create_403( request, _("You are not allowed to review your own proposals.")) if not self.proposal.can_be_reviewed(): messages.error(request, _("This proposal can no longer be reviewed.")) return HttpResponseRedirect( reverse('reviews-proposal-details', kwargs={'pk': self.proposal.pk})) if models.Review.objects.filter(user=request.user, proposal=self.proposal).count(): messages.info(request, _("You have already reviewed this proposal")) return HttpResponseRedirect( reverse('reviews-proposal-details', kwargs={'pk': self.proposal.pk})) self.proposal_version = models.ProposalVersion.objects.get_latest_for( self.proposal) return super(SubmitReviewView, self).dispatch(request, *args, **kwargs)
def get(self, request, *args, **kwargs): self.object = self.get_object() if not (utils.can_participate_in_review(self.request.user, self.object.original) or request.user.is_staff): return create_403(_("You have to be the author of this proposal or a reviewer to access this page")) return super(ProposalVersionDetailsView, self).get(request, *args, **kwargs)
def get(self, *args, **kwargs): self.object_list = self.get_queryset() if not (utils.can_participate_in_review(self.request.user, self.proposal) or self.request.user.is_staff): return create_403(_("You have to be the author of this proposal or a reviewer to access this page")) return super(ProposalVersionListView, self).get(*args, **kwargs)
def dispatch(self, request, *args, **kwargs): self.proposal = get_object_or_404(models.Proposal, pk=kwargs['pk']) if not utils.can_participate_in_review(request.user, self.proposal): return create_403(request) self.proposal_version = models.ProposalVersion.objects.get_latest_for(self.proposal) return super(SubmitCommentView, self).dispatch(request, *args, **kwargs)
def _wrapper(request, *args, **kwargs): if not (utils.can_review_proposal(request.user) or request.user.is_staff): return create_403(request, _("You have to be a reviewer or staff member to access this page.")) return func(request, *args, **kwargs)
def _wrapper(request, *args, **kwargs): if not utils.can_review_proposal(request.user): return create_403(request, _("You have to be a reviewer in order to access this page.")) return func(request, *args, **kwargs)