示例#1
0
 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)
示例#2
0
文件: views.py 项目: bmispelon/djep
 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)
示例#3
0
文件: views.py 项目: bmispelon/djep
 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)
示例#4
0
 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)
示例#5
0
 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)
示例#6
0
文件: views.py 项目: bmispelon/djep
 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)
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
文件: views.py 项目: bmispelon/djep
 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)
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 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)
示例#13
0
文件: views.py 项目: bmispelon/djep
 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)
示例#14
0
文件: views.py 项目: bmispelon/djep
 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)
示例#15
0
文件: views.py 项目: bmispelon/djep
 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)
示例#16
0
文件: views.py 项目: bmispelon/djep
 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)
示例#17
0
 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)
示例#18
0
 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)