adding steps to workout view
This commit is contained in:
@@ -189,6 +189,15 @@ def ps_dict_get_description(d):
|
||||
|
||||
return s
|
||||
|
||||
def ps_dict_get_description_html(d):
|
||||
s = '<ul>'
|
||||
steps = d['steps']
|
||||
for step in steps:
|
||||
s += '<li>'+step_to_string(step)+'</li>'
|
||||
|
||||
s += '</ul>'
|
||||
return s
|
||||
|
||||
|
||||
|
||||
class FitWorkoutSteps(object):
|
||||
@@ -1130,7 +1139,7 @@ def update_plannedsession(ps,cd):
|
||||
f = cd['fitfile']
|
||||
filename, path_and_filename = handle_uploaded_file(f)
|
||||
ps.fitfile.name = filename
|
||||
|
||||
|
||||
|
||||
ps.save()
|
||||
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% if steps %}
|
||||
<h2>Steps</h2>
|
||||
<p>{{ steps|safe }}</p>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
{% if plannedsession.sessiontype == 'test' or plannedsession.sessiontype == 'coursetest' or plannedsession.sessiontype == 'fastest_distance' or plannedsession.sessiontype == 'fastest_time' %}
|
||||
|
||||
@@ -2114,6 +2114,12 @@ def plannedsession_view(request,id=0,userid=0):
|
||||
|
||||
comments = PlannedSessionComment.objects.filter(plannedsession=ps).order_by("created")
|
||||
|
||||
steps = ''
|
||||
if ps.steps_json:
|
||||
d = json.loads(ps.steps_json)
|
||||
steps = ps_dict_get_description_html(d)
|
||||
|
||||
|
||||
return render(request,'plannedsessionview.html',
|
||||
{
|
||||
'psdict': psdict,
|
||||
@@ -2138,6 +2144,7 @@ def plannedsession_view(request,id=0,userid=0):
|
||||
'coursescript': coursescript,
|
||||
'coursediv': coursediv,
|
||||
'comments': comments,
|
||||
'steps':steps,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user