cvoelcker / clonecademy

This is the BP origin of clonecademy. If you want to contribute to the current project, go to https://github.com/msusenburger/clonecademy
Other
2 stars 2 forks source link

Validation goes wrong :( #48

Closed GeneralGeki closed 7 years ago

GeneralGeki commented 7 years ago

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)
cvoelcker commented 7 years ago

Build into frontend