first version
This commit is contained in:
@@ -83,104 +83,123 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% if workouts %}
|
{% if workouts %}
|
||||||
{% for workout in workouts %}
|
{% if request.GET.selectworkouts %}
|
||||||
<li class="grid_4 divlines">
|
<li class="grid_4">
|
||||||
{{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }}
|
<form enctype="multipart/form-data" method="post">
|
||||||
{% if workout.duplicate %}
|
<h3>Bulk Operation</h3>
|
||||||
<span style="font-size: smaller"><i class="fal fa-angle-double-up"></i></span>
|
<select name="selectworkouts_operation" id="selectworkouts_operation">
|
||||||
|
<option value="">--Please choose an option--</option>
|
||||||
|
<option value="remove">Remove</option>
|
||||||
|
</select>
|
||||||
|
{% csrf_token %}
|
||||||
|
<input name='selectworkouts' type="submit" value="Submit">
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for workout in workouts %}
|
||||||
|
<li class="grid_4 divlines">
|
||||||
|
{% if request.GET.selectworkouts %}
|
||||||
|
<input type="checkbox" id="workoutid" value={{ workout.id|encode }} name="workoutid" />
|
||||||
|
{% endif %}
|
||||||
|
{{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }}
|
||||||
|
{% if workout.duplicate %}
|
||||||
|
<span style="font-size: smaller"><i class="fal fa-angle-double-up"></i></span>
|
||||||
|
{% endif %}
|
||||||
|
{% if workout.rankingpiece %}
|
||||||
|
<span style="font-size: smaller"><i class="fal fa-asterisk"></i></span>
|
||||||
|
{% endif %}
|
||||||
|
{% if workout.rpe == 0 and not workout.duplicate %}
|
||||||
|
<span style="font-size: smaller">
|
||||||
|
<a href="/rowers/workout/{{ workout.id|encode }}/edit/">No RPE</a>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
<div>
|
||||||
|
{% if workout.name != '' %}
|
||||||
|
<h3>
|
||||||
|
{% if team %}
|
||||||
|
<a
|
||||||
|
href={% url rower.defaultlandingpage3 id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage3|verbose }}">
|
||||||
|
{{ workout.name }} ({{ workout.user.user.first_name }} {{ workout.user.user.last_name}})
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a
|
||||||
|
href={% url rower.defaultlandingpage3 id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage3|verbose }}">
|
||||||
|
{{ workout.name }}
|
||||||
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if workout.rankingpiece %}
|
</h3>
|
||||||
<span style="font-size: smaller"><i class="fal fa-asterisk"></i></span>
|
{% else %}
|
||||||
{% endif %}
|
<h3>
|
||||||
{% if workout.rpe == 0 and not workout.duplicate %}
|
{% if team %}
|
||||||
<span style="font-size: smaller">
|
<a
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/edit/">No RPE</a>
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
|
||||||
<div>
|
|
||||||
{% if workout.name != '' %}
|
|
||||||
<h3>
|
|
||||||
{% if team %}
|
|
||||||
<a
|
|
||||||
href={% url rower.defaultlandingpage3 id=workout.id|encode %}
|
|
||||||
title="{{ rower.defaultlandingpage3|verbose }}">
|
|
||||||
{{ workout.name }} ({{ workout.user.user.first_name }} {{ workout.user.user.last_name}})
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<a
|
|
||||||
href={% url rower.defaultlandingpage3 id=workout.id|encode %}
|
|
||||||
title="{{ rower.defaultlandingpage3|verbose }}">
|
|
||||||
{{ workout.name }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</h3>
|
|
||||||
{% else %}
|
|
||||||
<h3>
|
|
||||||
{% if team %}
|
|
||||||
<a
|
|
||||||
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
|
||||||
title="{{ rower.defaultlandingpage|verbose }}">
|
|
||||||
No Name ({{ workout.user.user.first_name }} {{ workout.user.user.last_name}})
|
|
||||||
</a>
|
|
||||||
{% else %}
|
|
||||||
<a
|
|
||||||
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
|
||||||
title="{{ rower.defaultlandingpage|verbose }}">
|
|
||||||
No Name
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
</h3>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="workoutcontainer">
|
|
||||||
<div class="icondiv">
|
|
||||||
{% with workout.workouttype|icon|safe as templateName %}
|
|
||||||
{% include templateName %}
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
|
||||||
<div class="workoutelement">
|
|
||||||
<span style="color:#555">Distance</span><br>
|
|
||||||
{{ workout.distance|distanceprint }}
|
|
||||||
</div>
|
|
||||||
<div class="workoutelement">
|
|
||||||
<span style="color:#555">Time</span><br>
|
|
||||||
{{ workout.duration |durationprint:"%H:%M:%S.%f" }}
|
|
||||||
</div>
|
|
||||||
<div class="workoutelement">
|
|
||||||
{% if workout|may_edit:request %}
|
|
||||||
<a class="small"
|
|
||||||
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
||||||
title="{{ rower.defaultlandingpage|verbose }}">
|
title="{{ rower.defaultlandingpage|verbose }}">
|
||||||
|
No Name ({{ workout.user.user.first_name }} {{ workout.user.user.last_name}})
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a
|
||||||
|
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage|verbose }}">
|
||||||
|
No Name
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</h3>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="workoutcontainer">
|
||||||
|
<div class="icondiv">
|
||||||
|
{% with workout.workouttype|icon|safe as templateName %}
|
||||||
|
{% include templateName %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
<span style="color:#555">Distance</span><br>
|
||||||
|
{{ workout.distance|distanceprint }}
|
||||||
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
<span style="color:#555">Time</span><br>
|
||||||
|
{{ workout.duration |durationprint:"%H:%M:%S.%f" }}
|
||||||
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
{% if workout|may_edit:request %}
|
||||||
|
<a class="small"
|
||||||
|
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage|verbose }}">
|
||||||
<i class="{{ rower.defaultlandingpage|landingicon }}"></i></a>
|
<i class="{{ rower.defaultlandingpage|landingicon }}"></i></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="workoutelement">
|
<div class="workoutelement">
|
||||||
{% if workout|may_edit:request %}
|
{% if workout|may_edit:request %}
|
||||||
{% if rower.defaultlandingpage2 != 'workout_delete' %}
|
{% if rower.defaultlandingpage2 != 'workout_delete' %}
|
||||||
<a class="small"
|
<a class="small"
|
||||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||||
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="small"
|
<a class="small"
|
||||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||||
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<li> No workouts found </li>
|
<li> No workouts found </li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if request.GET.selectworkouts %}
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<p>Filter on date
|
<p>Filter on date
|
||||||
<form enctype="multipart/form-data" method="post">
|
<form enctype="multipart/form-data" method="post">
|
||||||
|
|||||||
@@ -2047,7 +2047,16 @@ def workouts_view(request, message='', successmessage='',
|
|||||||
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
|
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
|
||||||
|
|
||||||
query = None
|
query = None
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
print(request.POST)
|
||||||
|
if 'selectworkouts' in request.POST:
|
||||||
|
if 'remove' in request.POST.get('selectworkouts_operation'):
|
||||||
|
remove_ids = request.POST.getlist('workoutid')
|
||||||
|
for id in remove_ids:
|
||||||
|
w = Workout.objects.get(id=encoder.decode_hex(id))
|
||||||
|
messages.info(request,'Removed workout '+str(id))
|
||||||
|
w.delete()
|
||||||
dateform = DateRangeForm(request.POST)
|
dateform = DateRangeForm(request.POST)
|
||||||
searchform = SearchForm(request.POST)
|
searchform = SearchForm(request.POST)
|
||||||
if dateform.is_valid(): # pragma: no cover
|
if dateform.is_valid(): # pragma: no cover
|
||||||
|
|||||||
Reference in New Issue
Block a user