added age verification and improvements on plannedsession
This commit is contained in:
@@ -325,12 +325,15 @@ class UpdateWindForm(forms.Form):
|
||||
|
||||
# Form to select a data range to show workouts from a certain time period
|
||||
class DateRangeForm(forms.Form):
|
||||
startdate = forms.DateField(initial=timezone.now()-datetime.timedelta(days=365),
|
||||
widget=SelectDateWidget(years=range(1990,2050)),
|
||||
label='Start Date')
|
||||
enddate = forms.DateField(initial=timezone.now(),
|
||||
widget=SelectDateWidget(years=range(1990,2050)),
|
||||
label='End Date')
|
||||
startdate = forms.DateField(
|
||||
initial=timezone.now()-datetime.timedelta(days=365),
|
||||
# widget=SelectDateWidget(years=range(1990,2050)),
|
||||
widget=AdminDateWidget(),
|
||||
label='Start Date')
|
||||
enddate = forms.DateField(
|
||||
initial=timezone.now(),
|
||||
widget=AdminDateWidget(),
|
||||
label='End Date')
|
||||
|
||||
class Meta:
|
||||
fields = ['startdate','enddate']
|
||||
@@ -393,11 +396,17 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
|
||||
('lwt','light-weight'),
|
||||
)
|
||||
|
||||
birthdate = forms.DateTimeField(widget=SelectDateWidget(
|
||||
years=range(timezone.now().year-100,timezone.now().year-10)),
|
||||
initial = datetime.date(year=1970,
|
||||
month=4,
|
||||
day=15))
|
||||
birthdate = forms.DateTimeField(
|
||||
widget=SelectDateWidget(),
|
||||
initial = datetime.date(year=1970,
|
||||
month=4,
|
||||
day=15))
|
||||
|
||||
def clean_birthdate(self):
|
||||
dob = self.cleaned_data['birthdate']
|
||||
age = (timezone.now() - dob).days/365
|
||||
if age < 16:
|
||||
raise forms.ValidationError('Must be at least 16 years old to register')
|
||||
|
||||
sex = forms.ChoiceField(required=True,
|
||||
choices=sexcategories,
|
||||
|
||||
@@ -914,8 +914,8 @@ class PlannedSessionForm(ModelForm):
|
||||
|
||||
widgets = {
|
||||
'comment': forms.Textarea,
|
||||
'startdate': DateInput(),
|
||||
'enddate': DateInput(),
|
||||
'startdate': AdminDateWidget(),
|
||||
'enddate': AdminDateWidget(),
|
||||
}
|
||||
|
||||
|
||||
@@ -1164,7 +1164,7 @@ class WorkoutForm(ModelForm):
|
||||
model = Workout
|
||||
fields = ['name','date','starttime','timezone','duration','distance','workouttype','notes','privacy','rankingpiece','boattype']
|
||||
widgets = {
|
||||
'date': DateInput(),
|
||||
'date': AdminDateWidget(),
|
||||
'notes': forms.Textarea,
|
||||
'duration': forms.TimeInput(format='%H:%M:%S.%f'),
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ def is_session_complete_ws(ws,ps):
|
||||
trimp = dataprep.workout_trimp(w)
|
||||
score += trimp
|
||||
elif ps.sessionmode == 'rScore':
|
||||
rscore = dataprep.workout_rscore(w)
|
||||
rscore = dataprep.workout_rscore(w)[0]
|
||||
score += rscore
|
||||
|
||||
value = ps.sessionvalue
|
||||
|
||||
@@ -125,3 +125,47 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("td #id_sessionmode").change(function() {
|
||||
|
||||
if (this.value == 'TRIMP') {
|
||||
$("td #id_sessionunit").prop("value","None");
|
||||
}
|
||||
if (this.value == 'distance') {
|
||||
$("td #id_sessionunit").prop("value","m");
|
||||
}
|
||||
if (this.value == 'time') {
|
||||
$("td #id_sessionunit").prop("value","min");
|
||||
}
|
||||
|
||||
if (this.value == 'rScore') {
|
||||
$("td #id_sessionunit").prop("value","None");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("td #id_sessiontype").change(function() {
|
||||
|
||||
if (this.value == 'session') {
|
||||
$("td #id_criterium").prop("value","none");
|
||||
}
|
||||
if (this.value == 'test') {
|
||||
$("td #id_criterium").prop("value","exact");
|
||||
}
|
||||
if (this.value == 'challenge') {
|
||||
$("td #id_criterium").prop("value","minimum");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div id="left" class="grid_6 alpha">
|
||||
<h1>Edit Session {{ thesession.name }}</h1>
|
||||
</div>
|
||||
<h1>Edit Session</h1>
|
||||
</div>
|
||||
<div id="timeperiod" class="grid_2 dropdown">
|
||||
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button>
|
||||
<div class="dropdown-content">
|
||||
@@ -47,29 +47,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_6 alpha">
|
||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ form.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<div class="grid_1 prefix_2 alpha">
|
||||
<a class="red button small" href="/rowers/sessions/{{ thesession.id }}/deleteconfirm">Delete</a>
|
||||
</div>
|
||||
<div class="grid_1">
|
||||
<a class="gray button small" href="/rowers/sessions/{{ thesession.id }}/clone">Clone</a>
|
||||
</div>
|
||||
<div id="formbutton" class="grid_1 suffix_1 omega">
|
||||
<input class="button green" type="submit" value="Save">
|
||||
</div>
|
||||
</div>
|
||||
<div id="right" class="grid_6 omega">
|
||||
<div id="right" class="grid_6 alpha">
|
||||
<h1>Plan</h1>
|
||||
<p>
|
||||
Click on session name to view
|
||||
@@ -124,8 +102,76 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="grid_6 omega">
|
||||
<h1>{{ thesession.name }}</h1>
|
||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||
{% if form.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ form.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<div class="grid_1 prefix_2 alpha">
|
||||
<a class="red button small" href="/rowers/sessions/{{ thesession.id }}/deleteconfirm">Delete</a>
|
||||
</div>
|
||||
<div class="grid_1">
|
||||
<a class="gray button small" href="/rowers/sessions/{{ thesession.id }}/clone">Clone</a>
|
||||
</div>
|
||||
<div id="formbutton" class="grid_1 suffix_1 omega">
|
||||
<input class="button green" type="submit" value="Save">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("td #id_sessionmode").change(function() {
|
||||
|
||||
if (this.value == 'TRIMP') {
|
||||
$("td #id_sessionunit").prop("value","None");
|
||||
}
|
||||
if (this.value == 'distance') {
|
||||
$("td #id_sessionunit").prop("value","m");
|
||||
}
|
||||
if (this.value == 'time') {
|
||||
$("td #id_sessionunit").prop("value","min");
|
||||
}
|
||||
|
||||
if (this.value == 'rScore') {
|
||||
$("td #id_sessionunit").prop("value","None");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("td #id_sessiontype").change(function() {
|
||||
|
||||
if (this.value == 'session') {
|
||||
$("td #id_criterium").prop("value","none");
|
||||
}
|
||||
if (this.value == 'test') {
|
||||
$("td #id_criterium").prop("value","exact");
|
||||
}
|
||||
if (this.value == 'challenge') {
|
||||
$("td #id_criterium").prop("value","minimum");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block meta %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}Planned Session{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
{% include "planningbuttons.html" %}
|
||||
|
||||
@@ -99,4 +103,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Contact Us{% endblock title %}
|
||||
{% block title %}Contact Us{% endblock title %}
|
||||
{% block meta %}
|
||||
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div id="registrationform" class="grid_6 alpha">
|
||||
|
||||
@@ -10,8 +13,8 @@
|
||||
{% endif %}
|
||||
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
{% csrf_token %}
|
||||
<table width=100%>
|
||||
{% csrf_token %}
|
||||
<table width=100%>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
<div class="grid_1 alpha">
|
||||
@@ -28,4 +31,4 @@
|
||||
<p> Registration is free. </p>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
|
||||
|
||||
2
static/admin/js/jquery.min.js
vendored
Normal file
2
static/admin/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -13,10 +13,9 @@
|
||||
|
||||
<script type="text/javascript" src="/admin/jsi18n/"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/core.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"> </script>
|
||||
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/actions.min.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"> </script>
|
||||
<script type="text/javascript" src="/static/admin/js/calendar.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/urlify.js"></script>
|
||||
<script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user