add more validation for countries

This commit is contained in:
Brian Wilson
2013-01-29 10:41:41 -05:00
parent 09ab52bc94
commit 69ff879e95

View File

@@ -255,9 +255,9 @@ class TestCenterUserForm(ModelForm):
def clean_country(self):
code = self.cleaned_data['country']
if code and len(code) != 3:
if code and (len(code) != 3 or not code.isalpha()):
raise forms.ValidationError(u'Must be three characters (ISO 3166-1): e.g. USA, CAN, MNG')
return code
return code.upper()
def clean(self):
def _can_encode_as_latin(fieldvalue):