ModelField Attributes are meaningless.
Everything has to be declared as a SerializerField to be validated correctly by the is_valid() function of the serializer
E.g.
class CourseCategorySerializer(serializers.ModelSerializer):
class Meta:
model = CourseCategory
fields = ('name', "color", "id",)
color = serializers.RegexField(r'^#[a-fA-F0-9]{6}', max_length=7,
min_length=7, allow_blank=False)
ModelField Attributes are meaningless. Everything has to be declared as a SerializerField to be validated correctly by the is_valid() function of the serializer
E.g.