Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
feat(kernel): search by name field (#702)
Browse files Browse the repository at this point in the history
  • Loading branch information
obdulia-losantos authored Oct 16, 2019
1 parent b84df27 commit 1a5a46a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions aether-kernel/aether/kernel/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ProjectViewSet(MtViewSetMixin, FilteredMixin, viewsets.ModelViewSet):
queryset = models.Project.objects.all()
serializer_class = serializers.ProjectSerializer
filter_class = filters.ProjectFilter
search_fields = ('name',)

@action(detail=True, methods=['get'], url_name='skeleton', url_path='schemas-skeleton')
def schemas_skeleton(self, request, pk=None, *args, **kwargs):
Expand Down Expand Up @@ -312,6 +313,7 @@ class MappingSetViewSet(MtViewSetMixin, FilteredMixin, viewsets.ModelViewSet):
queryset = models.MappingSet.objects.all()
serializer_class = serializers.MappingSetSerializer
filter_class = filters.MappingSetFilter
search_fields = ('name',)
mt_field = 'project'

@action(detail=True, methods=['post'], url_path='delete-artefacts')
Expand All @@ -333,6 +335,7 @@ class MappingViewSet(MtViewSetMixin, FilteredMixin, viewsets.ModelViewSet):
queryset = models.Mapping.objects.all()
serializer_class = serializers.MappingSerializer
filter_class = filters.MappingFilter
search_fields = ('name',)
mt_field = 'mappingset__project'

@action(detail=True, methods=['post'], url_path='delete-artefacts')
Expand Down Expand Up @@ -360,6 +363,7 @@ class SubmissionViewSet(MtViewSetMixin, FilteredMixin, ExporterViewSet):
queryset = models.Submission.objects.all()
serializer_class = serializers.SubmissionSerializer
filter_class = filters.SubmissionFilter
search_fields = ('project__name', 'mappingset__name',)
mt_field = 'project'

def check_realm_permission(self, request, mappingset):
Expand Down Expand Up @@ -487,6 +491,7 @@ class AttachmentViewSet(MtViewSetMixin, FilteredMixin, viewsets.ModelViewSet):
queryset = models.Attachment.objects.all()
serializer_class = serializers.AttachmentSerializer
filter_class = filters.AttachmentFilter
search_fields = ('name',)
mt_field = 'submission__project'

@action(detail=True, methods=['get'])
Expand All @@ -499,6 +504,7 @@ class SchemaViewSet(FilteredMixin, viewsets.ModelViewSet):
queryset = models.Schema.objects.all()
serializer_class = serializers.SchemaSerializer
filter_class = filters.SchemaFilter
search_fields = ('name',)

@action(detail=True, methods=['get'])
def skeleton(self, request, pk=None, *args, **kwargs):
Expand Down Expand Up @@ -568,6 +574,7 @@ class SchemaDecoratorViewSet(MtViewSetMixin, FilteredMixin, viewsets.ModelViewSe
queryset = models.SchemaDecorator.objects.all()
serializer_class = serializers.SchemaDecoratorSerializer
filter_class = filters.SchemaDecoratorFilter
search_fields = ('name',)
mt_field = 'project'

@action(detail=True, methods=['get'])
Expand Down Expand Up @@ -601,11 +608,12 @@ class EntityViewSet(MtViewSetMixin, FilteredMixin, ExporterViewSet):
queryset = models.Entity.objects.all()
serializer_class = serializers.EntitySerializer
filter_class = filters.EntityFilter
search_fields = ('project__name', 'schema__name',)
mt_field = 'project'

# Exporter required fields
schema_field = 'schemadecorator__schema__definition'
schema_order = '-schemadecorator__schema__created'
schema_field = 'schema__definition'
schema_order = '-schema__created'

def get_serializer(self, *args, **kwargs):
if 'data' in kwargs:
Expand Down

0 comments on commit 1a5a46a

Please sign in to comment.