Commit 69ff879e by Brian Wilson

add more validation for countries

parent 09ab52bc
...@@ -255,9 +255,9 @@ class TestCenterUserForm(ModelForm): ...@@ -255,9 +255,9 @@ class TestCenterUserForm(ModelForm):
def clean_country(self): def clean_country(self):
code = self.cleaned_data['country'] 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') 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 clean(self):
def _can_encode_as_latin(fieldvalue): def _can_encode_as_latin(fieldvalue):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment