def download_vote(request, vote_pk=None): vote = get_object_or_404(Vote, pk=vote_pk, published_at__isnull=False) vote_ct = ContentType.objects.get_for_model(Vote) try: signed_vote_doc = Document.objects.get(content_type=vote_ct, object_id=vote.id) except Document.DoesNotExist: raise Http404('No signed document for vote %s available' % (vote_pk)) return handle_download(request, signed_vote_doc)
def download_document(request, meeting_pk=None, document_pk=None, view=False): meeting = get_object_or_404(Meeting, pk=meeting_pk) with sudo(): doc = get_object_or_404( Document, content_type=ContentType.objects.get_for_model(SubmissionForm), object_id__in=SubmissionForm.objects.filter( submission__in=meeting.timetable_entries.values('submission_id')), pk=document_pk ) return handle_download(request, doc, view=view)
def download_document(request, docstash_key=None, document_pk=None, view=False): docstash = get_object_or_404(DocStash, key=docstash_key, owner=request.user) if int(document_pk) not in docstash.value['document_pks']: raise Http404() return handle_download(request, Document.objects.get(pk=document_pk), view=view)
def checklist_pdf(request, checklist_pk=None): checklist = get_object_or_404(Checklist, pk=checklist_pk) return handle_download(request, checklist.pdf_document)
def download_document(request, notification_pk=None, document_pk=None, view=False): notification = get_object_or_404(Notification, pk=notification_pk) document = get_object_or_404(notification.documents, pk=document_pk) return handle_download(request, document, view=view)
def notification_pdf(request, notification_pk=None): notification = get_object_or_404(Notification, pk=notification_pk) return handle_download(request, notification.pdf_document)
def checklist_payment_pdf(request, payment_pk=None): payment = get_object_or_404(ChecklistPayment, pk=payment_pk) return handle_download(request, payment.document)
def invoice_pdf(request, invoice_pk=None): invoice = get_object_or_404(Invoice, pk=invoice_pk) return handle_download(request, invoice.document)
def download_attachment(request, pk=None, view=False): comment = get_object_or_404(Comment, pk=pk, attachment__isnull=False) return handle_download(request, comment.attachment, view=view)