diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index d35045ed39..f39cc2e119 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -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):