@@ -30,6 +30,9 @@ import patchwork.views.api as api
# /self
users_router = routers.SimpleRouter()
users_router.register('self', api.UserViewSet)
+# /self/reviews
+self_reviews_router = routers.SimpleRouter()
+self_reviews_router.register('self/reviews', api.SeriesReviewsViewSet)
# /projects/$project/
project_router = routers.SimpleRouter()
project_router.register('projects', api.ProjectViewSet)
@@ -52,6 +55,7 @@ urlpatterns = patterns('',
# API
(r'^api/1.0/', include(users_router.urls)),
+ (r'^api/1.0/', include(self_reviews_router.urls)),
(r'^api/1.0/', include(project_router.urls)),
(r'^api/1.0/', include(series_list_router.urls)),
(r'^api/1.0/', include(series_router.urls)),
@@ -62,6 +62,18 @@ class SeriesListMixin:
ordering_fields = ('name', 'n_patches', 'submitter__name', 'reviewer__name',
'submitted', 'last_updated')
+class SeriesReviewsViewSet(mixins.ListModelMixin,
+ SeriesListMixin,
+ viewsets.GenericViewSet):
+ permission_classes = (UserPermission, )
+
+ def get_queryset(self):
+ filter_kwargs = { 'reviewer': self.request.user }
+
+ # Ensure queryset is re-evaluated on each request.
+ queryset = self.queryset.filter(**filter_kwargs)
+ return queryset
+
class ProjectViewSet(viewsets.ViewSet):
permission_classes = (MaintainerPermission, )
model = Project
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- patchwork/urls.py | 4 ++++ patchwork/views/api.py | 12 ++++++++++++ 2 files changed, 16 insertions(+)