Commit 65ee2b07 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

make gene length positive only

parent 65eab49d
......@@ -16,7 +16,7 @@ from metagenedb.apps.catalog.serializers import GeneSerializer
window_size_param = openapi.Parameter('window_size', in_=openapi.IN_QUERY, description='Size of the window.',
type=openapi.TYPE_INTEGER, default=10000)
gene_length_schema = openapi.Schema("pouet", {}, type={'hihi': 'haha'})
gene_length_response = openapi.Response('return JSON content', schema=gene_length_schema)
gene_length_response = openapi.Response('Get the distribution of gene length for a given window size', schema=gene_length_schema)
class GeneViewSet(mixins.ListModelMixin,
......@@ -47,13 +47,12 @@ class GeneViewSet(mixins.ListModelMixin,
@swagger_auto_schema(
manual_parameters=[window_size_param],
responses = {
responses={
'200': gene_length_response,
'204': 'no content'
},
},
security=[],
operation_id='List of categories',
operation_description='Get the distribution of gene length for a given window size.',
)
@action(methods=['get'], detail=False)
def gene_length(self, request, window_size=10000):
......
# Generated by Django 2.2.1 on 2019-08-07 13:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalog', '0006_gene_taxonomy'),
]
operations = [
migrations.AlterField(
model_name='gene',
name='gene_length',
field=models.PositiveIntegerField(),
),
]
......@@ -5,7 +5,7 @@ from .function import Function
class Gene(models.Model):
gene_id = models.CharField(max_length=100, unique=True, db_index=True)
gene_length = models.IntegerField()
gene_length = models.PositiveIntegerField()
functions = models.ManyToManyField(Function)
taxonomy = models.ForeignKey(
'Taxonomy', related_name='genes',
......
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