Fixed my music page

This commit is contained in:
Tris Forster 2026-05-29 22:47:33 +10:00
parent 5468f6d3e7
commit ca3effcad1
3 changed files with 20 additions and 21 deletions

View File

@ -33,4 +33,4 @@
</div>
</div>
{% endfor %}
</div>
</div>

View File

@ -31,12 +31,6 @@
</span>
</span>
</div>
<span class="control">
<button type="submit" class="button is-primary">
<span class="icon"><i class="fas fa-copy"></i></span>
<span>Get My Parts!</span>
</button>
</span>
</div>
</div>
@ -45,6 +39,7 @@
<tr>
<th/>
<th>Piece</th>
<th>Composer</th>
<th class="is-hidden-mobile">Running time</th>
<th>Part</th>
<th/>
@ -61,6 +56,7 @@
{{ item.work.name }}
{% endif %}
</td>
<td class="is-hidden-mobile">{{ item.work.composer }}</td>
<td class="is-hidden-mobile">{% firstof item.work.running_time "------" %}</td>
<td class="select-cell">
<input type="hidden" name="works" value="{{ item.work.pk }}"/>
@ -74,8 +70,9 @@
</span>
</td>
<td>
<span class="is-action" onclick="downloadPart({{ item.work.collection_id }}, {{ item.work.pk }})">
<i class="fas fa-download" title="Download Part"></i>
<span class="button is-link is-small" onclick="downloadPart({{ item.work.collection_id }}, {{ item.work.pk }})">
<span class="icon"><i class="fas fa-download" title="Download Part"></i></span>
<span>Get</span>
</span>
</td>
</tr>
@ -85,13 +82,11 @@
<tr>
<td/>
<td/>
<td>{% firstof running_time "------" %}</td>
<td/>
<td>
<!--
<button class="button is-link is-small" type="submit"><span class="icon"><i class="fas fa-copy"></i></span><span>Single combined PDF</span></button>
<a class="button is-link is-small"><span class="icon"><i class="fas fa-archive"></i></span><span>Individual files (zipped)</span></a>
-->
<td>{% firstof running_time "------" %}</td>
<td colspan="2">
<button class="button is-link is-small" type="submit" name="action" value="pdf"><span class="icon"><i class="fas fa-copy"></i></span><span>Single combined PDF</span></button>
<button class="button is-link is-small" type="submit" name="action" value="zip"><span class="icon"><i class="fas fa-archive"></i></span><span>Individual files (zipped)</span></button>
</td>
</tr>
</tfoot>

View File

@ -38,7 +38,8 @@ class ProjectItemListView(ProjectMixin, ListView):
project_works = self.project.works.all()
instruments = request.POST.getlist("instruments")
print(request.POST)
instruments = request.POST.getlist("instrument-selection")
works = request.POST.getlist("works")
request.session["part"] = request.POST.get("part", "")
@ -65,13 +66,16 @@ class ProjectItemListView(ProjectMixin, ListView):
(part.doc.upload.path, part.doc.work.name, part.start, part.end, 1)
)
result = extract_and_concat(sections)
action = request.POST.get("action")
if action == "pdf":
result = extract_and_concat(sections)
download_name = f"{self.project.name}.pdf"
download_name = f"{self.project.name}.pdf"
response = FileResponse(result, content_type="application/pdf")
response["Content-Disposition"] = f'inline; filename="{download_name}"'
return response
response = FileResponse(result, content_type="application/pdf")
response["Content-Disposition"] = f'inline; filename="{download_name}"'
return response
return HttpResponse(f"Unknown action: {action}", status=400)
def get_queryset(self):
return (