forked from smari/wasa2il
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from piratar/development
Version 0.10.2
- Loading branch information
Showing
13 changed files
with
265 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.10.1 | ||
0.10.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
from django.conf.urls import include | ||
from django.conf.urls import url | ||
|
||
from core import views as core_views | ||
|
||
|
||
urlpatterns = [ | ||
url(r'^$', core_views.home), | ||
url(r'^$', core_views.home, name='home'), | ||
url(r'^terms/', include('termsandconditions.urls')), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
from HTMLParser import HTMLParser | ||
|
||
#class MLStripper(HTMLParser): | ||
# def __init__(self): | ||
# self.reset() | ||
# self.fed = [] | ||
# def handle_data(self, d): | ||
# self.fed.append(d) | ||
# def get_data(self): | ||
# return ''.join(self.fed) | ||
# | ||
#def strip_tags(html): | ||
# s = MLStripper() | ||
# s.feed(html) | ||
# return s.get_data() | ||
|
||
|
||
class AttrDict(dict): | ||
__getattr__ = dict.__getitem__ | ||
|
||
def __setattr__(self, key, value): | ||
self[key] = value | ||
from datetime import datetime | ||
|
||
from dateutil.relativedelta import relativedelta | ||
|
||
def ssn_is_formatted_correctly(ssn): | ||
# We don't need any hard-core checksumming here, since we're only making | ||
# sure that the data format is correct, so that we can safely retrieve | ||
# parts of it through string manipulation. | ||
return ssn.isdigit() and len(ssn) == 10 | ||
|
||
def calculate_age_from_ssn(ssn): | ||
if not ssn_is_formatted_correctly(ssn): | ||
raise AttributeError('SSN must be numeric and exactly 10 digits long') | ||
|
||
# Determine year. | ||
century_num = ssn[9:] | ||
if century_num == '9': | ||
century = 1900 | ||
elif century_num == '0': | ||
century = 2000 | ||
else: | ||
raise AttributeError('%s is not a known number for any century' % century_num) | ||
year = century + int(ssn[4:6]) | ||
|
||
# Determine month and day | ||
month = int(ssn[2:4]) | ||
day = int(ssn[0:2]) | ||
|
||
# Calculate the differences between birthdate and today. | ||
birthdate = datetime(year, month, day) | ||
today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) | ||
age = relativedelta(today, birthdate).years | ||
|
||
return age | ||
|
||
def is_ssn_human_or_institution(ssn): | ||
if not ssn_is_formatted_correctly(ssn): | ||
raise AttributeError('SSN must be numeric and exactly 10 digits long') | ||
|
||
return 'institution' if int(ssn[0:2]) > 31 else 'human' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
wasa2il/templates/registration/verification_age_limit.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% extends "base.html" %} | ||
{% load i18n %} | ||
|
||
{% block content %} | ||
|
||
<section class="content"> | ||
|
||
<div class="col-md-6"> | ||
|
||
<h1>{% trans 'Age below age limit' %}</h1> | ||
|
||
<h3>{% blocktrans %}We are sorry to inform you that you have not yet reached the minimum required age of {{ age_limit }} years. According to our information, you are {{ age }} years old.{% endblocktrans %}</h3> | ||
|
||
<h3>{% trans 'We will be very happy to provide you with access once you reach the minimum required age.' %}</h3> | ||
|
||
<a href="{% url 'home' %}" class="btn btn-primary">{% trans 'Front page' %}</a> | ||
|
||
</div> | ||
|
||
</section> | ||
|
||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.