Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1254 from akatsoulas/api-internal-queries
Browse files Browse the repository at this point in the history
Add 'Peers' and 'Review' in internal API queries.
  • Loading branch information
akatsoulas authored Oct 4, 2016
2 parents d846b5b + 75bc02a commit 1bd97f4
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions remo/profiles/api/api_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1bd97f4

Please sign in to comment.