Fixed my music page
This commit is contained in:
parent
5468f6d3e7
commit
ca3effcad1
@ -33,4 +33,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -31,12 +31,6 @@
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -45,6 +39,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th/>
|
<th/>
|
||||||
<th>Piece</th>
|
<th>Piece</th>
|
||||||
|
<th>Composer</th>
|
||||||
<th class="is-hidden-mobile">Running time</th>
|
<th class="is-hidden-mobile">Running time</th>
|
||||||
<th>Part</th>
|
<th>Part</th>
|
||||||
<th/>
|
<th/>
|
||||||
@ -61,6 +56,7 @@
|
|||||||
{{ item.work.name }}
|
{{ item.work.name }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="is-hidden-mobile">{{ item.work.composer }}</td>
|
||||||
<td class="is-hidden-mobile">{% firstof item.work.running_time "------" %}</td>
|
<td class="is-hidden-mobile">{% firstof item.work.running_time "------" %}</td>
|
||||||
<td class="select-cell">
|
<td class="select-cell">
|
||||||
<input type="hidden" name="works" value="{{ item.work.pk }}"/>
|
<input type="hidden" name="works" value="{{ item.work.pk }}"/>
|
||||||
@ -74,8 +70,9 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="is-action" onclick="downloadPart({{ item.work.collection_id }}, {{ item.work.pk }})">
|
<span class="button is-link is-small" onclick="downloadPart({{ item.work.collection_id }}, {{ item.work.pk }})">
|
||||||
<i class="fas fa-download" title="Download Part"></i>
|
<span class="icon"><i class="fas fa-download" title="Download Part"></i></span>
|
||||||
|
<span>Get</span>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -85,13 +82,11 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td/>
|
<td/>
|
||||||
<td/>
|
<td/>
|
||||||
<td>{% firstof running_time "------" %}</td>
|
|
||||||
<td/>
|
<td/>
|
||||||
<td>
|
<td>{% firstof running_time "------" %}</td>
|
||||||
<!--
|
<td colspan="2">
|
||||||
<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>
|
<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>
|
||||||
<a class="button is-link is-small"><span class="icon"><i class="fas fa-archive"></i></span><span>Individual files (zipped)</span></a>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
|||||||
@ -38,7 +38,8 @@ class ProjectItemListView(ProjectMixin, ListView):
|
|||||||
|
|
||||||
project_works = self.project.works.all()
|
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")
|
works = request.POST.getlist("works")
|
||||||
|
|
||||||
request.session["part"] = request.POST.get("part", "")
|
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)
|
(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")
|
return HttpResponse(f"Unknown action: {action}", status=400)
|
||||||
response["Content-Disposition"] = f'inline; filename="{download_name}"'
|
|
||||||
return response
|
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user