–
</td>
<td>
- <span class="text-secondary" class="edit-youtube-volume" data-audiobook="{{ audiobook.id }}">
- {{ audiobook.youtube_volume }}
+ <span class="text-secondary">
+ <form method="POST" action="{% url 'book_youtube_volume' audiobook.id %}">
+ {% csrf_token %}
+ <input name='volume' value="{{ audiobook.youtube_volume }}" class="form-control">
+ </form>
</span>
</td>
<td>
+ </td> >
+ <td class="text-secondary">
+ {{ audiobook.duration|duration }}
</td>
<td>
</td>
- <td>
- {{ audiobook.duration }}
- </td>
{% endifchanged %}
</tr>
{% endfor %}
qs = models.Audiobook.objects.filter(slug=self.kwargs["slug"]).order_by(
"index"
)
- total = 0
last_vol = None
for b in qs:
- if last_vol != b.youtube_volume:
- last_vol = b.youtube_volume
- total = 0
- total = b.total = total + b.duration
+ if last_vol is None or last_vol.youtube_volume != b.youtube_volume:
+ last_vol = b
+ b.total = 0
+ last_vol.total += b.duration
return list(qs)