from rest_framework import serializers
from .models import Doctor_Type


class DoctorTypeSerializer(serializers.ModelSerializer):


    class Meta:
        model = Doctor_Type
        fields = '__all__'

    def validate(self, data):
        name = data.get('name')
        if Doctor_Type.objects.filter(name__iexact=name).exists():
            raise serializers.ValidationError('This Type is already present')
        return data

6f1b55fbc8399636cbafd999acfcfcac765811d8
<mask token>

<mask token>


class DoctorTypeSerializer(serializers.ModelSerializer):


    class Meta:
        model = Doctor_Type
        fields = '__all__'
    <mask token>

<mask token>


class DoctorTypeSerializer(serializers.ModelSerializer):


    class Meta:
        model = Doctor_Type
        fields = '__all__'

    def validate(self, data):
        name = data.get('name')
        if Doctor_Type.objects.filter(name__iexact=name).exists():
            raise serializers.ValidationError('This Type is already present')
        return data

from rest_framework import serializers
from .models import Doctor_Type


class DoctorTypeSerializer(serializers.ModelSerializer):


    class Meta:
        model = Doctor_Type
        fields = '__all__'

    def validate(self, data):
        name = data.get('name')
        if Doctor_Type.objects.filter(name__iexact=name).exists():
            raise serializers.ValidationError('This Type is already present')
        return data
