Commit 9eb64580 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

allow put from list on gene

parent 98af56fe
......@@ -10,6 +10,8 @@ from metagenedb.common.utils.df_operations import get_mask
from metagenedb.apps.catalog.models import Gene
from metagenedb.apps.catalog.serializers import GeneSerializer
from .bulk_viewset import BulkViewSet
class DocGeneLength(object):
......@@ -41,7 +43,7 @@ class DocGeneLength(object):
class GeneViewSet(ModelViewSet):
class GeneViewSet(BulkViewSet):
queryset = Gene.objects.all()
serializer_class = GeneSerializer
lookup_field = 'gene_id'
......@@ -6,9 +6,17 @@ from rest_framework.utils import model_meta
from metagenedb.apps.catalog.models import Function, Gene, Taxonomy
from metagenedb.apps.catalog.serializers import FunctionSerializer
from .bulk_list import BulkListSerializer
_LOGGER = logging.getLogger(__name__)
class GeneListSerializer(BulkListSerializer):
class Meta:
model = Gene
class GeneSerializer(serializers.ModelSerializer):
functions = FunctionSerializer(
......@@ -22,6 +30,7 @@ class GeneSerializer(serializers.ModelSerializer):
class Meta:
model = Gene
list_serializer_class = GeneListSerializer
fields = ('gene_id', 'gene_name', 'length', 'functions', 'taxonomy')
def _extract_many_to_many(self, validated_data, info):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment