def get(self, external_key=None, enrollment_type=None, state=None, **kwargs): if state: state = [x.strip() for x in state.split(',')] state = [Enrollment.ENROLLMENT_STATUS_CHOICES_REVERSE.get(s, s) for s in state if s] enrollments = Enrollment.list(external_key=external_key, enrollment_type=enrollment_type, state=state) query_filter = current_enrollments.list_permission_filter enrollments = query_filter(enrollments) pagination = Pagination(current_app, db) return pagination.paginate(enrollments, self.enrollment_fields, post_query_hook=lambda l: NeverEmptyList(l))
def get_page_requests(page): ''' Function to fetch and return all feature requests ''' app.app.config['PAGINATE_PAGE_SIZE'] = ROWS_PER_PAGE pagination = Pagination(app.app, db) schema = { 'name': fields.String, 'description': fields.String, 'date': fields.String, 'priority': fields.Integer, 'client': fields.String, 'productarea': fields.String } return pagination.paginate(FeatureRequest, schema)