ENH: Collections DRF (#25)
This commit is contained in:
parent
b9659f6622
commit
04fd45e5de
8 changed files with 123 additions and 1 deletions
10
ccdb/locations/serializers.py
Normal file
10
ccdb/locations/serializers.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from .models import StudyLocation
|
||||
|
||||
|
||||
class StudyLocationSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = StudyLocation
|
||||
fields = ('name', 'code', 'study_location_type', 'treatment_type',
|
||||
'collecting_location', 'description', 'sort_order')
|
9
ccdb/locations/viewsets.py
Normal file
9
ccdb/locations/viewsets.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from rest_framework import viewsets
|
||||
|
||||
from .models import StudyLocation
|
||||
from .serializers import StudyLocationSerializer
|
||||
|
||||
|
||||
class StudyLocationViewSet(viewsets.ModelViewSet):
|
||||
queryset = StudyLocation.objects.all()
|
||||
serializer_class = StudyLocationSerializer
|
Loading…
Add table
Add a link
Reference in a new issue