Layout tweeks
This commit is contained in:
@@ -290,8 +290,8 @@ class WorkPartSetView(CollectionMixin, DetailView):
|
||||
for i, tag in enumerate(parts):
|
||||
c = int(copies[i])
|
||||
if c > 0:
|
||||
part = models.Section.objects.select_related('doc').get(tag=tag, doc__work=work)
|
||||
sections.append((part.doc.upload.path, part.name, part.start, part.end, c))
|
||||
for part in models.Section.objects.select_related('doc').filter(tag=tag, doc__work=work):
|
||||
sections.append((part.doc.upload.path, part.name, part.start, part.end, c))
|
||||
|
||||
result = extract_and_concat(sections)
|
||||
|
||||
@@ -458,6 +458,9 @@ class PartDownloadView(CollectionMixin, SingleObjectMixin, View):
|
||||
self.args = args
|
||||
self.object = self.get_object()
|
||||
|
||||
if self.object.start is None:
|
||||
return redirect(self.object.doc.upload.url)
|
||||
|
||||
result = extract_pages(self.object.doc.upload.path, self.object.doc.work.name, self.object.start, self.object.end)
|
||||
|
||||
#download_name = f'{self.object.doc.work.name}_{self.object.instrument}.pdf'
|
||||
@@ -466,10 +469,6 @@ class PartDownloadView(CollectionMixin, SingleObjectMixin, View):
|
||||
response['Content-Disposition'] = f'inline; filename="{self.args["filename"]}"'
|
||||
return response
|
||||
|
||||
def get_queryset(self):
|
||||
def get_object(self):
|
||||
|
||||
if self.request.is_admin:
|
||||
parts = Section.objects.all()
|
||||
else:
|
||||
parts = Section.objects.filter(doc__work__collection__allowed_ensembles__ensemble=self.request.ensemble_id)
|
||||
return parts.select_related('doc', 'doc__work')
|
||||
return Section.objects.filter(doc__work__collection=self.collection).select_related('doc', 'doc__work').get(pk=self.kwargs['section'])
|
||||
Reference in New Issue
Block a user