mysociety / contract-countdown

https://mysociety.github.io/contract-countdown/
0 stars 0 forks source link

Postcode error handling #23

Closed alexander-griffen closed 1 year ago

alexander-griffen commented 1 year ago

When the postcode is entered, validation occurs as part of the clean function of the form.

The postcode validation is the same as that in CAPE.

Also, validation errors for that field have been added to the html template.

alexander-griffen commented 1 year ago

One small issue with the postcode widget but the rest looks good.

The only thing that would be good is it currently just ignores various exceptions in the mapit call and those should probably get handled. Certainly the NotFoundException which is thrown if you put in a postcode that is valid but doesn't exist, e.g. KY34 9QZ

This has been achieved - albeit slightly jankily - by moving the logic of the mapit call to the validation step, so that errors can be caught.

zarino commented 1 year ago

This branch was merged straight into master :+1: