Commit 6bb713e6 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

add taxonomy and functions API

parent b70d190e
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from metagenedb.api.catalog.views import GeneViewSet
from metagenedb.api.catalog.views import FunctionViewSet, GeneViewSet, TaxonomyViewSet
api_router = DefaultRouter()
api_router.register(r'functions', FunctionViewSet, base_name='functions')
api_router.register(r'genes', GeneViewSet, base_name='genes')
api_router.register(r'taxonomy', TaxonomyViewSet, base_name='taxonomy')
urlpatterns = [
......
from .function import FunctionViewSet # noqa
from .gene import GeneViewSet # noqa
from .taxonomy import TaxonomyViewSet # noqa
from rest_framework.viewsets import ModelViewSet
from metagenedb.apps.catalog.models import Function
from metagenedb.apps.catalog.serializers import FunctionSerializer
class FunctionViewSet(ModelViewSet):
queryset = Function.objects.all()
serializer_class = FunctionSerializer
lookup_field = 'function_id'
from rest_framework.viewsets import ModelViewSet
from metagenedb.apps.catalog.models import Taxonomy
from metagenedb.apps.catalog.serializers import TaxonomySerializer
class TaxonomyViewSet(ModelViewSet):
queryset = Taxonomy.objects.all()
serializer_class = TaxonomySerializer
lookup_field = 'tax_id'
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