@@ -255,9 +255,9 @@ class TestCenterUserForm(ModelForm):
defclean_country(self):
code=self.cleaned_data['country']
ifcodeandlen(code)!=3:
ifcodeand(len(code)!=3ornotcode.isalpha()):
raiseforms.ValidationError(u'Must be three characters (ISO 3166-1): e.g. USA, CAN, MNG')
returncode
returncode.upper()
defclean(self):
def_can_encode_as_latin(fieldvalue):
...
...
@@ -387,6 +387,12 @@ class TestCenterRegistration(models.Model):
return'Update'
elifself.uploaded_atisNone:
return'Add'
elifself.registration_is_rejected:
# Assume that if the registration was rejected before,
# it is more likely this is the (first) correction
# than a second correction in flight before the first was
# processed.
return'Add'
else:
# TODO: decide what to send when we have uploaded an initial version,
# but have not received confirmation back from that upload. If the
...
...
@@ -400,7 +406,8 @@ class TestCenterRegistration(models.Model):
@property
defexam_authorization_count(self):
# TODO: figure out if this should really go in the database (with a default value).
# Someday this could go in the database (with a default value). But at present,
# we do not expect anyone to be authorized to take an exam more than once.
return1
@property
...
...
@@ -499,6 +506,33 @@ class TestCenterRegistration(models.Model):
defregistration_signup_url(self):
returnsettings.PEARSONVUE_SIGNINPAGE_URL
defdemographics_status(self):
ifself.demographics_is_accepted:
return"Accepted"
elifself.demographics_is_rejected:
return"Rejected"
else:
return"Pending"
defaccommodation_status(self):
ifself.accommodation_is_skipped:
return"Skipped"
elifself.accommodation_is_accepted:
return"Accepted"
elifself.accommodation_is_rejected:
return"Rejected"
else:
return"Pending"
defregistration_status(self):
ifself.registration_is_accepted:
return"Accepted"
elifself.registration_is_rejected:
return"Rejected"
else:
return"Pending"
classTestCenterRegistrationForm(ModelForm):
classMeta:
model=TestCenterRegistration
...
...
@@ -518,7 +552,15 @@ class TestCenterRegistrationForm(ModelForm):
registration.save()
log.info("Updated registration information for user's test center exam registration: username \"{}\" course \"{}\", examcode \"{}\"".format(registration.testcenter_user.user.username,registration.course_id,registration.exam_series_code))
# TODO: add validation code for values added to accommodation_code field.