Skip to content

Serializers

hypha.apply.api.v1.reminder.serializers

SubmissionReminderSerializer

Bases: ModelSerializer

Meta

model class-attribute instance-attribute
model = Reminder
fields class-attribute instance-attribute
fields = ('time', 'action_type', 'is_expired', 'id', 'action', 'title', 'description')
read_only_fields class-attribute instance-attribute
read_only_fields = ('action_type', 'is_expired')

validate

validate(data)

Check title is empty.

Source code in hypha/apply/api/v1/reminder/serializers.py
def validate(self, data):
    """
    Check title is empty.
    """
    required_fields = ["title"]
    for field in required_fields:
        if not data.get(field, None):
            raise serializers.ValidationError({field: "shouldn't be empty"})
    return data