first version of session create page
This commit is contained in:
@@ -862,8 +862,14 @@ class PlannedSession(models.Model):
|
|||||||
class PlannedSessionForm(ModelForm):
|
class PlannedSessionForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PlannedSession
|
model = PlannedSession
|
||||||
fields = ['name','comment','startdate','enddate','sessionvalue',
|
fields = ['startdate',
|
||||||
'sessionunit']
|
'enddate',
|
||||||
|
'sessiontype',
|
||||||
|
'sessionmode',
|
||||||
|
'sessionvalue',
|
||||||
|
'sessionunit',
|
||||||
|
'comment',
|
||||||
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'comment': forms.Textarea,
|
'comment': forms.Textarea,
|
||||||
'startdate': SelectDateWidget(
|
'startdate': SelectDateWidget(
|
||||||
|
|||||||
35
rowers/templates/plannedsessioncreate.html
Normal file
35
rowers/templates/plannedsessioncreate.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
|
{% block title %}New Planned Session{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="grid_12 alpha">
|
||||||
|
{% include "planningbuttons.html" %}
|
||||||
|
|
||||||
|
<h1>Create a new Planned Session</h1>
|
||||||
|
</div>
|
||||||
|
<div id="left" 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 id="formbutton" class="grid_1 prefix_4 suffix_1">
|
||||||
|
<input class="button green" type="submit" value="Submit">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="right" class="grid_6 omega">
|
||||||
|
<p>Not yet defined</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
21
rowers/templates/planningbuttons.html
Normal file
21
rowers/templates/planningbuttons.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{% load rowerfilters %}
|
||||||
|
<div class="grid_2 alpha">
|
||||||
|
<p>
|
||||||
|
<a class="button gray small" href="/rowers/sessions">Plan Overview</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid_2">
|
||||||
|
<p>
|
||||||
|
<a class="button gray small" href="/rowers/sessions/review">Review Sessions</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid_2">
|
||||||
|
<p>
|
||||||
|
<a class="button gray small" href="/rowers/sessions/manage">Manage Sessions</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid_2 suffix_4 omega">
|
||||||
|
<p>
|
||||||
|
<a class="button gray small" href="/rowers/sessions/create">Add Session</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
<div id="thumb-container" class="grid_2 omega">
|
<div id="thumb-container" class="grid_2 omega">
|
||||||
<a href="/rowers/graph/{{ graph.id }}/">
|
<a href="/rowers/graph/{{ graph.id }}/">
|
||||||
<img src="/{{ graph.filename }}"
|
<img src="/{{ graph.filename }}"
|
||||||
onerror="this.src='/static/img/ajax_loader_blue_350.gif'"
|
onerror="this.src='/static/img/rowingtimer.gif'"
|
||||||
alt="{{ graph.filename }}" width="120" height="100"></a>
|
alt="{{ graph.filename }}" width="120" height="100"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
<div id="thumb-container" class="grid_2">
|
<div id="thumb-container" class="grid_2">
|
||||||
<a href="/rowers/graph/{{ graph.id }}/">
|
<a href="/rowers/graph/{{ graph.id }}/">
|
||||||
<img src="/{{ graph.filename }}"
|
<img src="/{{ graph.filename }}"
|
||||||
onerror="this.src='/static/img/ajax_loader_blue_350.gif'"
|
onerror="this.src='/static/img/rowingtimer.gif'"
|
||||||
alt="{{ graph.filename }}" width="120" height="100"></a>
|
alt="{{ graph.filename }}" width="120" height="100"></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -186,14 +186,14 @@
|
|||||||
<div id="thumb-container" class="grid_2 alpha">
|
<div id="thumb-container" class="grid_2 alpha">
|
||||||
<a href="/rowers/graph/{{ graph.id }}/">
|
<a href="/rowers/graph/{{ graph.id }}/">
|
||||||
<img src="/{{ graph.filename }}"
|
<img src="/{{ graph.filename }}"
|
||||||
onerror="this.src='/static/img/ajax_loader_blue_350.gif'"
|
onerror="this.src='/static/img/rowingtimer.gif'"
|
||||||
alt="{{ graph.filename }}" width="120" height="100"></a>
|
alt="{{ graph.filename }}" width="120" height="100"></a>
|
||||||
</div>
|
</div>
|
||||||
{% elif forloop.counter == 3 %}
|
{% elif forloop.counter == 3 %}
|
||||||
<div id="thumb-container" class="grid_2 omega">
|
<div id="thumb-container" class="grid_2 omega">
|
||||||
<a href="/rowers/graph/{{ graph.id }}/">
|
<a href="/rowers/graph/{{ graph.id }}/">
|
||||||
<img src="/{{ graph.filename }}"
|
<img src="/{{ graph.filename }}"
|
||||||
onerror="this.src='/static/img/ajax_loader_blue_350.gif'"
|
onerror="this.src='/static/img/rowingtimer.gif'"
|
||||||
alt="{{ graph.filename }}" width="120" height="100"></a>
|
alt="{{ graph.filename }}" width="120" height="100"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
<div id="thumb-container" class="grid_2">
|
<div id="thumb-container" class="grid_2">
|
||||||
<a href="/rowers/graph/{{ graph.id }}/">
|
<a href="/rowers/graph/{{ graph.id }}/">
|
||||||
<img src="/{{ graph.filename }}"
|
<img src="/{{ graph.filename }}"
|
||||||
onerror="this.src='/static/img/ajax_loader_blue_350.gif'"
|
onerror="this.src='/static/img/rowingtimer.gif'"
|
||||||
alt="{{ graph.filename }}" width="120" height="100"></a>
|
alt="{{ graph.filename }}" width="120" height="100"></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ urlpatterns = [
|
|||||||
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>[\w\ ]+.*)/$',views.workout_comparison_view2),
|
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>[\w\ ]+.*)/$',views.workout_comparison_view2),
|
||||||
url(r'^test\_callback',views.rower_process_testcallback),
|
url(r'^test\_callback',views.rower_process_testcallback),
|
||||||
url(r'^workout/(?P<id>\d+)/test\_strokedata$',views.strokedataform),
|
url(r'^workout/(?P<id>\d+)/test\_strokedata$',views.strokedataform),
|
||||||
|
url(r'^sessions/create$',views.session_create_view),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|||||||
@@ -50,13 +50,16 @@ from rowers.forms import (
|
|||||||
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
||||||
TrendFlexModalForm,WorkoutSplitForm,WorkoutJoinParamForm,
|
TrendFlexModalForm,WorkoutSplitForm,WorkoutJoinParamForm,
|
||||||
)
|
)
|
||||||
from rowers.models import Workout, User, Rower, WorkoutForm,FavoriteChart
|
from rowers.models import (
|
||||||
|
Workout, User, Rower, WorkoutForm,FavoriteChart,
|
||||||
|
PlannedSession
|
||||||
|
)
|
||||||
from rowers.models import (
|
from rowers.models import (
|
||||||
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,
|
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,
|
||||||
RowerPowerZonesForm,AccountRowerForm,UserForm,StrokeData,
|
RowerPowerZonesForm,AccountRowerForm,UserForm,StrokeData,
|
||||||
Team,TeamForm,TeamInviteForm,TeamInvite,TeamRequest,
|
Team,TeamForm,TeamInviteForm,TeamInvite,TeamRequest,
|
||||||
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
WorkoutComment,WorkoutCommentForm,RowerExportForm,
|
||||||
CalcAgePerformance,PowerTimeFitnessMetric,
|
CalcAgePerformance,PowerTimeFitnessMetric,PlannedSessionForm
|
||||||
)
|
)
|
||||||
from rowers.models import FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement
|
from rowers.models import FavoriteForm,BaseFavoriteFormSet,SiteAnnouncement
|
||||||
from rowers.metrics import rowingmetrics,defaultfavoritecharts
|
from rowers.metrics import rowingmetrics,defaultfavoritecharts
|
||||||
@@ -11699,6 +11702,22 @@ def agegrouprecordview(request,sex='male',weightcategory='hwt',
|
|||||||
'the_div':div,
|
'the_div':div,
|
||||||
})
|
})
|
||||||
|
|
||||||
@user_passes_test(hasplannedsessions,login_url="/",redirect_field_name=None)
|
@user_passes_test(hasplannedsessions,login_url="/",
|
||||||
|
redirect_field_name=None)
|
||||||
def session_create_view(request):
|
def session_create_view(request):
|
||||||
return 1
|
if request.method == 'POST':
|
||||||
|
sessioncreateform = PlannedSessionForm(request.POST)
|
||||||
|
if sessioncreateform.is_valid():
|
||||||
|
cd = sessioncreateform.cleaned_data
|
||||||
|
# do something with data
|
||||||
|
|
||||||
|
url = reverse(session_create_view)
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
else:
|
||||||
|
sessioncreateform = PlannedSessionForm()
|
||||||
|
|
||||||
|
return render(request,'plannedsessioncreate.html',
|
||||||
|
{
|
||||||
|
'teams':get_my_teams(request.user),
|
||||||
|
'form':sessioncreateform,
|
||||||
|
})
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 294 KiB |
Reference in New Issue
Block a user