-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BuildTools
committed
Nov 4, 2023
1 parent
4859e8c
commit 764fd6c
Showing
4 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
from rest_framework import viewsets | ||
|
||
from django_filters import FilterSet | ||
|
||
from api_v2 import models | ||
from api_v2 import serializers | ||
|
||
|
||
class AlignmentFilterSet(FilterSet): | ||
class Meta: | ||
model = models.Alignment | ||
fields = { | ||
'key': ['in', 'iexact', 'exact' ], | ||
'name': ['iexact', 'exact','contains'], | ||
'document__key': ['in','iexact','exact'], | ||
} | ||
|
||
class AlignmentViewSet(viewsets.ReadOnlyModelViewSet): | ||
""" | ||
list: API endpoint for returning a list of alignments. | ||
retrieve: API endpoint for returning a particular alignment. | ||
""" | ||
queryset = models.Alignment.objects.all().order_by('pk') | ||
serializer_class = serializers.AlignmentSerializer | ||
|
||
|
||
|
||
filterset_class = AlignmentFilterSet |