gealogiuya
Some checks failed
Deploy Django Application to Server / deploy (push) Failing after 19s
Telegram Notifications / Telegram Gate (push) Failing after 5s

This commit is contained in:
2026-02-27 14:56:23 +05:00
commit 0229a0595c
118 changed files with 33948 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
from typing import Type
from rest_framework import serializers
from apps.geology.models import Category, Geology
class CategorySerializer(serializers.ModelSerializer):
count = serializers.SerializerMethodField()
class Meta:
model: Type[Category] = Category
fields: str = ("id", "count", "name", "created_at", "updated_at")
def get_count(self, obj):
return Geology.objects.filter(category=obj).count()