Commit a577fa53 authored by Benoit Alessandroni's avatar Benoit Alessandroni

Work on retrieving only validated resources

parent 7cabc7ba
"""djangoldp project URL Configuration"""
from django.conf.urls import url
from .views import PendingResourcesViewSet
from .views import ValidatedResourcesViewSet
urlpatterns = [
url(r'^resources/validated/', ValidatedResourcesViewSet.urls(model_prefix="resources-validated")),
url(r'^resources/pending/', PendingResourcesViewSet.urls(model_prefix="resources-pending")),
]
\ No newline at end of file
from djangoldp.views import LDPViewSet
from .models import Resource
class ValidatedResourcesViewSet(LDPViewSet):
model = Resource
def get_queryset(self, *args, **kwargs):
return super().get_queryset(*args, **kwargs)\
.filter(review__status='validated')\
.exclude(submitter__username=self.request.user.username)
class PendingResourcesViewSet(LDPViewSet):
model = Resource
......
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