

def clean(self):
    if (not self.errors):
        ModelClass = self.content_type.model_class()
        try:
            current_instance = ModelClass.objects.get(pk=self.instance_pk)
        except ObjectDoesNotExist as e:
            raise forms.ValidationError(e)
        if (not hasattr(current_instance, self.field_name)):
            raise forms.ValidationError('{0} model has no field named {1}'.format(ModelClass.__name__, self.field_name))
        setattr(current_instance, self.field_name, self.cleaned_data['content'])
        current_instance.full_clean()
    return self.cleaned_data

dataset/ETHPy150Open caktus/django-scribbler/scribbler/forms.py FieldScribbleForm.clean/original