import sform


class StrippedCharField(sform.CharField):
    def clean(self, new_value, old_value, required, trim_on_empty, base_initial, base_data):
        new_value = new_value.strip()
        return super().clean(new_value, old_value, required, trim_on_empty, base_initial, base_data)

    @property
    def type_name(self):
        return sform.CharField().type_name
