Fixed #3879 -- Updated Norwegian social security validation rules. Thanks,

bp@datakortet.no.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@4888 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-04-01 05:00:44 +00:00
parent b11454dc3d
commit a599f1234e
1 changed files with 4 additions and 2 deletions

View File

@ -46,10 +46,12 @@ class NOSocialSecurityNumber(Field):
try:
if 000 <= inum < 500:
self.birthday = datetime.date(1900+year2, month, day)
if 500 <= inum < 750:
if 500 <= inum < 750 and year2 > 54:
self.birthday = datetime.date(1800+year2, month, day)
if 500 <= inum < 1000:
if 500 <= inum < 1000 and year2 < 40:
self.birthday = datetime.date(2000+year2, month, day)
if 900 <= inum < 1000 and year2 > 39:
self.birthday = datetime.date(1900+year2, month, day)
except ValueError:
raise ValidationError(msg)