class GET(FollowingSearchHandler): meta_serializer = DatasetsMeta() request_schema = DatasetsList() response_serializer = DatasetSerializer(many=True, include_data=('institution', )) search_document = DatasetsDoc() def _queryset(self, cleaned, *args, **kwargs): qs = super()._queryset(cleaned, *args, **kwargs) return qs.filter('match', status='published')
class GET(SearchHandler): meta_serializer = DatasetsMeta() request_schema = DatasetsList() response_serializer = DatasetSerializer(many=True) search_document = DatasetsDoc() def _queryset(self, cleaned, *args, **kwargs): qs = super()._queryset(cleaned, *args, **kwargs) if 'id' in kwargs: qs = qs.query("nested", path="institution", query=Q("term", **{'institution.id': kwargs['id']})) return qs
class GET(RetrieveOneFollowHandler): database_model = apps.get_model('datasets', 'Dataset') response_serializer = DatasetSerializer(many=False, include_data=('institution', 'resources')) triggers = [ LoginOptional(), ] def resource_clean(self, request, id, *args, **kwargs): model = self.database_model try: return model.objects.get(pk=id, status="published") except model.DoesNotExist: raise falcon.HTTPNotFound
class GET(FollowedListHandler): meta_serializer = DatasetsMeta() request_schema = DatasetsList() response_serializer = DatasetSerializer(many=True, include_data=('institution', )) search_document = DatasetsDoc()
class DELETE(DeleteFollowingHandler): database_model = apps.get_model('users', 'UserFollowingDataset') resource_model = apps.get_model('datasets', 'Dataset') resource_name = 'dataset' response_serializer = DatasetSerializer(many=False)