first version
This commit is contained in:
@@ -83,104 +83,123 @@
|
||||
</li>
|
||||
|
||||
{% if workouts %}
|
||||
{% for workout in workouts %}
|
||||
<li class="grid_4 divlines">
|
||||
{{ 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>
|
||||
{% if request.GET.selectworkouts %}
|
||||
<li class="grid_4">
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
<h3>Bulk Operation</h3>
|
||||
<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 %}
|
||||
{% 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 %}
|
||||
</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"
|
||||
</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 %}
|
||||
title="{{ rower.defaultlandingpage|verbose }}">
|
||||
<i class="{{ rower.defaultlandingpage|landingicon }}"></i></a>
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="workoutelement">
|
||||
{% if workout|may_edit:request %}
|
||||
{% if rower.defaultlandingpage2 != 'workout_delete' %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="workoutelement">
|
||||
{% if workout|may_edit:request %}
|
||||
{% if rower.defaultlandingpage2 != 'workout_delete' %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||
{% else %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||
{% else %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
<li> No workouts found </li>
|
||||
{% endif %}
|
||||
{% if request.GET.selectworkouts %}
|
||||
</form>
|
||||
{% endif %}
|
||||
<li class="grid_4">
|
||||
<p>Filter on date
|
||||
<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))
|
||||
|
||||
query = None
|
||||
|
||||
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)
|
||||
searchform = SearchForm(request.POST)
|
||||
if dateform.is_valid(): # pragma: no cover
|
||||
|
||||
Reference in New Issue
Block a user