Hi all,

I have defined a BillShipProfile via the (now deprecated) 
AUTH_PROFILE_MODULE setting, and defined a custom field with custom 
validation, as such:

class PostcodeField(models.CharField):
    default_validators = [validate_postcode]

    def __init__(self, *args, **kwargs):
        kwargs['max_length'] = 4
        super(PostcodeField, self).__init__(*args, **kwargs)

validate_postcode raises ValidationError if validation fails. I would 
expect this to be the same as raising ValidationError in one of the form's 
clean_ methods.

However when a ValidationError is raised in that field, I get the following 
unhandled exception:

ValueError at /accounts/update/
The BillShipProfile could not be changed because the data didn't validate.

The offending mezzanine source is line 206 of 
mezzanine/accounts/forms.py<https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/accounts/forms.py#L206>
:

profile_fields_form(self.data, self.files, instance=profile).save()



Any idea what's going on? I'm getting mush brain from trying to figure out why 
it's not working.


I would expect it to send me back to the profile update page with an error 
attached, just like raising ValidationError from clean_* does.


Thanks


Sam

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to