def get_queryset(self): query = (Q('registration_schema', 'eq', get_prereg_schema()) & Q('approval', 'ne', None)) ordering = self.get_ordering() if 'initiator' in ordering: return DraftRegistration.find(query).sort(ordering) if ordering == SORT_BY['title']: return DraftRegistration.find(query).sort( 'registration_metadata.q1.value') if ordering == SORT_BY['n_title']: return DraftRegistration.find(query).sort( '-registration_metadata.q1.value') return sort_drafts(DraftRegistration.find(query), ordering)
def get_queryset(self): query = ( Q('registration_schema', 'eq', get_prereg_schema()) & Q('approval', 'ne', None) ) ordering = self.get_ordering() if 'initiator' in ordering: return DraftRegistration.find(query).sort(ordering) if ordering == SORT_BY['title']: return DraftRegistration.find(query).sort( 'registration_metadata.q1.value') if ordering == SORT_BY['n_title']: return DraftRegistration.find(query).sort( '-registration_metadata.q1.value') return sort_drafts(DraftRegistration.find(query), ordering)