forked from STOCD/OSCR-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Fetching Variants independently from Ladders
- Loading branch information
Showing
12 changed files
with
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v2024.4b130 | ||
v2024.6b90 |
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,2 +1,4 @@ | ||
from .ladder import * | ||
from .ladder_entry import * | ||
from .variant import * | ||
|
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" Variant Filter """ | ||
|
||
from core.filters import BaseFilterSet | ||
from ladder.models import Variant | ||
|
||
|
||
class VariantFilter(BaseFilterSet): | ||
"""Filter for model""" | ||
|
||
class Meta: | ||
"""Meta class for filter""" | ||
|
||
model = Variant | ||
exclude = [] |
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,2 +1,3 @@ | ||
from .ladder import * | ||
from .ladder_entry import * | ||
from .variant import * |
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,2 +1,3 @@ | ||
from .ladder import * | ||
from .ladder_entry import * | ||
from .variant import * |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" Variant Serializers """ | ||
|
||
from rest_framework import serializers | ||
|
||
from ladder.models import Variant | ||
|
||
|
||
class VariantSerializer(serializers.ModelSerializer): | ||
"""Variant Serializer""" | ||
|
||
class Meta: | ||
model = Variant | ||
exclude = [] |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" Variant URLs """ | ||
|
||
from django.urls import include, path | ||
from rest_framework import routers | ||
|
||
from ladder import views | ||
|
||
router = routers.DefaultRouter() | ||
router.register("variant", views.VariantViewSet) | ||
|
||
urlpatterns = [ | ||
path("", include(router.urls)), | ||
] |
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,2 +1,3 @@ | ||
from .ladder import * | ||
from .ladder_entry import * | ||
from .variant import * |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" Variant Views """ | ||
|
||
import logging | ||
|
||
from rest_framework.filters import OrderingFilter, SearchFilter | ||
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin | ||
from rest_framework.viewsets import GenericViewSet | ||
|
||
from core.filters import BaseFilterBackend | ||
from core.pagination import AllResultsPagination | ||
from ladder.filters import VariantFilter | ||
from ladder.models import Variant | ||
from ladder.serializers import VariantSerializer | ||
|
||
LOGGER = logging.getLogger("django") | ||
|
||
|
||
class VariantViewSet( | ||
GenericViewSet, | ||
ListModelMixin, | ||
RetrieveModelMixin, | ||
): | ||
"""Variant API""" | ||
|
||
queryset = Variant.objects.all() | ||
serializer_class = VariantSerializer | ||
pagination_class = AllResultsPagination | ||
filter_backends = (BaseFilterBackend, OrderingFilter, SearchFilter) | ||
filterset_class = VariantFilter | ||
ordering_fields = "__all__" | ||
ordering = ["name"] |