Commit fcb49688 authored by cermak's avatar cermak
Browse files

[Fix] Panel do not see own proposals

parent a4f80f9c
......@@ -130,15 +130,18 @@ class ProposalsDetailView(LoginRequiredMixin, DetailView):
def get_queryset(self):
# check permission
qs = super(ProposalsDetailView, self).get_queryset()
myqs = qs.filter(Q(proposer=self.request.user) |
Q(coproposers__uid__exact=self.request.user) |
Q(local_contacts__uid__exact=self.request.user))
if self.request.user.has_perm('app.view_proposals'):
qs = super(ProposalsDetailView, self).get_queryset().distinct()
pass # view all
elif self.request.user.has_perm('app.view_panel_proposals') or self.request.user.has_perm('app.view_board_proposals'):
qs = super(ProposalsDetailView, self).get_queryset().exclude(last_status__in='P').exclude(proposaltype='T').distinct()
qs = qs.exclude(last_status__in='P').exclude(proposaltype='T')
qs = qs.union(myqs)
else: # can view only if it is part of the team
qs = super(ProposalsDetailView, self).get_queryset().filter(Q(proposer=self.request.user) |
Q(coproposers__uid__exact=self.request.user) |
Q(local_contacts__uid__exact=self.request.user)).distinct()
return qs
qs = myqs
return qs.distinct()
def get_context_data(self, *args, **kwargs):
context = super(ProposalsDetailView, self).get_context_data(*args, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment