Commit 2f25484f authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

code gardening

parent 16f8beba
Pipeline #12760 passed with stage
in 1 minute and 8 seconds
from .genes import gene_detail, gene_list # noqa
from .gene import gene_detail, gene_list # noqa
from .statistics import gene_length # noqa
\ No newline at end of file
......@@ -10,10 +10,10 @@ from metagenedb.apps.catalog.serializers import GeneSerializer
@api_view(['GET'])
def gene_list(request):
"""
List genes, or create new gene
List genes
"""
nextPage = 1
previousPage = 1
next_page = 1
previous_page = 1
genes = Gene.objects.all()
page = request.GET.get('page', 1)
paginator = Paginator(genes, 10)
......@@ -26,14 +26,14 @@ def gene_list(request):
serializer = GeneSerializer(data, context={'request': request}, many=True)
if data.has_next():
nextPage = data.next_page_number()
next_page = data.next_page_number()
if data.has_previous():
previousPage = data.previous_page_number()
previous_page = data.previous_page_number()
return Response(
{'data': serializer.data, 'count': paginator.count, 'numpages': paginator.num_pages,
'nextlink': '/api/genes/?page=' + str(nextPage),
'prevlink': '/api/genes/?page=' + str(previousPage)}
'nextlink': '/api/genes/?page=' + str(next_page),
'prevlink': '/api/genes/?page=' + str(previous_page)}
)
......
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