-
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
3e5014b
commit 530243e
Showing
5 changed files
with
41 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"""Serializer for the Condition model.""" | ||
|
||
from rest_framework import serializers | ||
|
||
from api_v2 import models | ||
|
||
from .abstracts import GameContentSerializer | ||
|
||
class ConditionSerializer(GameContentSerializer): | ||
key = serializers.ReadOnlyField() | ||
|
||
class Meta: | ||
model = models.Condition | ||
fields = '__all__' |
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,16 @@ | ||
from rest_framework import viewsets | ||
|
||
from api_v2 import models | ||
from api_v2 import serializers | ||
|
||
|
||
class ConditionViewSet(viewsets.ReadOnlyModelViewSet): | ||
""" | ||
list: API endpoint for returning a list of conditions. | ||
retrieve: API endpoint for returning a particular condition. | ||
""" | ||
queryset = models.Condition.objects.all().order_by('pk') | ||
serializer_class = serializers.ConditionSerializer | ||
|
||
|
||
|
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