suppurt list api admin uchun chiqarildi

This commit is contained in:
behruz-dev
2025-12-03 15:50:42 +05:00
parent 9276124cea
commit 731abb6936
3 changed files with 137 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
# rest framework
from rest_framework import serializers
# shared
from core.apps.shared.models import Support
class SupportListSerializer(serializers.ModelSerializer):
user = serializers.SerializerMethodField(method_name='get_user')
district = serializers.SerializerMethodField(method_name='get_district')
class Meta:
model = Support
fields = [
'id', 'problem', 'date', 'type', 'district', 'user', 'created_at'
]
def get_district(self, obj):
return {
'id': obj.district.id,
'name': obj.district.name,
}
def get_user(self, obj):
return {
'id': obj.user.id,
'first_name': obj.user.first_name,
'last_name': obj.user.last_name,
}