airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 01/03: Faking pagination of groups for now
Date Fri, 16 Feb 2018 16:50:33 GMT
This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit 3bba4402ba5368c434c8911db800a6ea66077ec6
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Thu Feb 15 17:11:16 2018 -0500

    Faking pagination of groups for now
---
 django_airavata/apps/api/views.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 45a2eb1..0c4db23 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -197,9 +197,16 @@ class GroupViewSet(APIBackedViewSet):
 
     serializer_class = serializers.GroupSerializer
     lookup_field = 'group_id'
+    pagination_class = APIResultPagination
+    pagination_viewname = 'django_airavata_api:group-list'
 
     def get_list(self):
-        return self.request.profile_service['group_manager'].getGroups(self.authz_token)
+        view = self
+        class GroupResultsIterator(APIResultIterator):
+            def get_results(self, limit=-1, offset=0):
+                groups = view.request.profile_service['group_manager'].getGroups(view.authz_token)
+                return groups[offset:offset+limit] if groups else []
+        return GroupResultsIterator()
 
     def get_instance(self, lookup_value):
         return self.request.airavata_client.getGroup(self.authz_token, self.gateway_id, lookup_value)

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

Mime
View raw message