Commit 266e125e authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

use prefetch and select to improve performances

parent ead2f182
Pipeline #17578 passed with stages
in 2 minutes and 35 seconds
......@@ -43,7 +43,7 @@ class DocGeneLength(object):
class GeneViewSet(BulkViewSet):
queryset = Gene.objects.all()
queryset = Gene.objects.select_related('taxonomy').prefetch_related('functions').all()
serializer_class = GeneSerializer
lookup_field = 'gene_id'
GENE_LENGTH_COL = 'length'
......
......@@ -8,7 +8,8 @@ from .bulk_viewset import BulkViewSet
class TaxonomyViewSet(BulkViewSet):
queryset = Taxonomy.objects.all()
queryset = Taxonomy.objects.select_related(
"parent", "superkingdom", "kingdom", "phylum", "class_rank", "order", "family", "genus", "species").all()
serializer_class = TaxonomySerializer
lookup_field = 'tax_id'
filterset_class = TaxonomyFilter
......
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