from rest_framework import serializers

from .models import Notification


class NotificationSerializer(serializers.ModelSerializer[Notification]):
    id = serializers.IntegerField(source="notification_id", read_only=True)
    created_at_timestamp = serializers.SerializerMethodField()

    class Meta:
        model = Notification
        fields = ("id", "title", "body", "seen_at", "created_at_timestamp")
        read_only_fields = fields

    def get_created_at_timestamp(self, obj: Notification) -> int:
        return int(obj.created_at.timestamp())

Homonyms

cyberia/research/events/backend/cyber_valley/shaman_verification/serializers.py
cyberia/research/events/backend/cyber_valley/siwe/serializers.py
cyberia/research/events/backend/cyber_valley/telegram_bot/serializers.py
cyberia/research/events/backend/cyber_valley/geodata/serializers.py
cyberia/research/events/backend/cyber_valley/custom_auth/serializers.py
cyberia/research/events/backend/cyber_valley/users/serializers.py
cyberia/research/events/backend/cyber_valley/web3_auth/serializers.py
cyberia/research/events/backend/cyber_valley/events/serializers.py

Graph