from rest_framework import serializers
from apps.edu.models import Certificate
from apps.edu.services import make_img_x

class CertificateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Certificate
        fields = '__all__'
        read_only_fields = ['create_time', 'update_time', 'create_by', 'update_by', 'is_deleted']

    def save(self, **kwargs):
        instance = super().save(**kwargs)
        make_img_x(instance)
        return instance