first version
This commit is contained in:
@@ -83,8 +83,24 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% if workouts %}
|
{% if workouts %}
|
||||||
|
{% 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 %}
|
{% for workout in workouts %}
|
||||||
<li class="grid_4 divlines">
|
<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" }}
|
{{ workout.date|date:"Y-m-d" }} {{ workout.starttime|date:"H:i" }}
|
||||||
{% if workout.duplicate %}
|
{% if workout.duplicate %}
|
||||||
<span style="font-size: smaller"><i class="fal fa-angle-double-up"></i></span>
|
<span style="font-size: smaller"><i class="fal fa-angle-double-up"></i></span>
|
||||||
@@ -181,6 +197,9 @@
|
|||||||
{% 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