From 75bc02a3bd85078103e39bd7a3eb059ac892e3e8 Mon Sep 17 00:00:00 2001 From: Tasos Katsoulas Date: Tue, 4 Oct 2016 16:28:09 +0300 Subject: [PATCH] Add 'Peers' and 'Review' in internal API queries. --- remo/profiles/api/api_v1.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/remo/profiles/api/api_v1.py b/remo/profiles/api/api_v1.py index faa3c5901..9e34e55b1 100644 --- a/remo/profiles/api/api_v1.py +++ b/remo/profiles/api/api_v1.py @@ -123,8 +123,7 @@ class RepResource(RemoThrottleMixin, ModelResource): full=True, null=True) class Meta: - cache = HttpCache(control={'max_age': 3600, 'public': True, - 's-maxage': 3600}) + cache = HttpCache(control={'max_age': 3600, 'public': True, 's-maxage': 3600}) queryset = User.objects.filter(userprofile__registration_complete=True, groups__name='Rep') resource_name = 'rep' @@ -178,14 +177,15 @@ def apply_filters(self, request, applicable_filters): group = request.GET.get('group', None) if group: if group == 'mentor': - base_object_list = (base_object_list. - filter(groups__name='Mentor')) + base_object_list = base_object_list.filter(groups__name='Mentor') elif group == 'council': - base_object_list = (base_object_list. - filter(groups__name='Council')) + base_object_list = base_object_list.filter(groups__name='Council') elif group == 'rep': - base_object_list = (base_object_list. - filter(groups__name='Rep')) + base_object_list = base_object_list.filter(groups__name='Rep') + elif group == 'review': + base_object_list = base_object_list.filter(groups__name='Review') + elif group == 'peers': + base_object_list = base_object_list.filter(groups__name='Peers') return base_object_list @@ -213,8 +213,7 @@ def apply_sorting(self, obj_list, options=None): def create_response(self, request, data, **response_kwargs): """Add HTTP header to specify the filename of CSV exports.""" - response = super(RepResource, self).create_response( - request, data, **response_kwargs) + response = super(RepResource, self).create_response(request, data, **response_kwargs) if self.determine_format(request) == 'text/csv': today = now().date()