Commit c1a82033 authored by Benoit Alessandroni's avatar Benoit Alessandroni

Adding proper target check on resource endpoint

parent 08198a7e
......@@ -7,8 +7,15 @@ class ValidatedResourcesByStepViewSet(LDPViewSet):
def get_queryset(self, *args, **kwargs):
step_id = self.kwargs['id']
if self.request.user.mentor_profile:
target='mentor'
elif self.request.user.entrepreneur_profile:
target='entrepreneur'
else:
target='public'
return super().get_queryset(*args, **kwargs)\
.filter(steps__in=step_id, review__status='validated')\
.filter(steps__in=step_id, review__status='validated', target__value=target)\
.exclude(submitter__username=self.request.user.username)
class PendingResourcesViewSet(LDPViewSet):
......
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