예제 #1
0
파일: views.py 프로젝트: JTLX/pybbm
    def get_queryset(self):
        if not perms.may_view_forum(self.request.user, self.forum):
            raise PermissionDenied

        qs = self.forum.topics.order_by("-sticky", "-updated", "-id").select_related()
        qs = perms.filter_topics(self.request.user, qs)
        return qs
예제 #2
0
    def get_queryset(self):
        if not perms.may_view_forum(self.request.user, self.forum):
            raise PermissionDenied

        qs = self.forum.topics.order_by('-sticky', '-updated', '-id').select_related()
        qs = perms.filter_topics(self.request.user, qs)
        return qs
예제 #3
0
파일: views.py 프로젝트: pbiogy/pybbm
    def get_queryset(self):
        self.forum = get_object_or_404(Forum.objects.all(), pk=self.kwargs['pk'])
        if not perms.may_view_forum(self.request.user, self.forum):
            raise PermissionDenied

        qs = self.forum.topics.order_by('-sticky', '-updated').select_related()
        qs = perms.filter_topics(self.request.user, qs)
        return qs
예제 #4
0
파일: views.py 프로젝트: Bishi/VlcWebpage
    def get_queryset(self):
        self.forum = get_object_or_404(Forum.objects.all(), pk=self.kwargs['pk'])
        if not perms.may_view_forum(self.request.user, self.forum):
            raise PermissionDenied

        qs = self.forum.topics.order_by('-sticky', '-updated', '-id').select_related()
        qs = perms.filter_topics(self.request.user, qs)
        return qs
예제 #5
0
 def get_queryset(self):
     self.forum = get_object_or_404(Forum.objects.all(), pk=self.kwargs['pk'])
     if not perms.may_view_forum(self.request.user, self.forum):
         raise PermissionDenied
     qs = self.forum.topics.annotate(votes=Sum('vote_set__vote')).order_by('-sticky', '-votes').select_related()
     if not (self.request.user.is_superuser or self.request.user in self.forum.moderators.all()):
         if self.request.user.is_authenticated():
             qs = qs.filter(Q(user=self.request.user)|Q(on_moderation=False))
         else:
             qs = qs.filter(on_moderation=False)
     return qs
예제 #6
0
파일: views.py 프로젝트: datajockey/pybbm
    def get_queryset(self):
        self.forum = get_object_or_404(Forum.objects.all(),
                                       pk=self.kwargs['pk'])
        if not perms.may_view_forum(self.request.user, self.forum):
            raise PermissionDenied

        qs = self.forum.topics.order_by('-sticky', '-updated').select_related()
        if not (self.request.user.is_superuser
                or self.request.user in self.forum.moderators.all()):
            if self.request.user.is_authenticated():
                qs = qs.filter(
                    Q(user=self.request.user) | Q(on_moderation=False))
            else:
                qs = qs.filter(on_moderation=False)
        return qs