Skip to content

Commit

Permalink
Add appealtype name to ops-learning
Browse files Browse the repository at this point in the history
  • Loading branch information
szabozoltan69 committed Jul 22, 2024
1 parent 3967220 commit 17d0645
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion per/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from drf_spectacular.utils import extend_schema_field
from rest_framework import serializers

from api.models import Appeal, Country, Region
from api.models import Appeal, AppealType, Country, Region
from api.serializers import (
MiniCountrySerializer,
RegoCountrySerializer,
Expand Down Expand Up @@ -867,6 +867,7 @@ class Meta:
class MiniAppealSerializer(serializers.ModelSerializer):
name = serializers.SerializerMethodField()
start_date = serializers.SerializerMethodField()
atype = serializers.SerializerMethodField()
dtype = serializers.SerializerMethodField()
country = serializers.SerializerMethodField()
region = serializers.SerializerMethodField()
Expand All @@ -881,6 +882,10 @@ def get_name(obj):
def get_start_date(obj):
return obj.start_date and obj.start_date.year

@staticmethod
def get_atype(obj):
return obj.atype or AppealType(obj.atype).label

@staticmethod
def get_dtype(obj):
return obj.dtype and obj.dtype.name
Expand Down Expand Up @@ -918,6 +923,11 @@ class Meta:


class FullAppealSerializer(serializers.ModelSerializer):
atype = serializers.SerializerMethodField()

@staticmethod
def get_atype(obj):
return obj.atype or AppealType(obj.atype).label

class Meta:
model = Appeal
Expand Down

0 comments on commit 17d0645

Please sign in to comment.