예제 #1
0
파일: views.py 프로젝트: wuxxin/ecs
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)
예제 #2
0
파일: views.py 프로젝트: wuxxin/ecs
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)
예제 #3
0
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)
예제 #4
0
파일: views.py 프로젝트: wuxxin/ecs
def checklist_pdf(request, checklist_pk=None):
    checklist = get_object_or_404(Checklist, pk=checklist_pk)
    return handle_download(request, checklist.pdf_document)
예제 #5
0
파일: views.py 프로젝트: wuxxin/ecs
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)
예제 #6
0
파일: views.py 프로젝트: wuxxin/ecs
def notification_pdf(request, notification_pk=None):
    notification = get_object_or_404(Notification, pk=notification_pk)
    return handle_download(request, notification.pdf_document)
예제 #7
0
파일: views.py 프로젝트: wuxxin/ecs
def checklist_payment_pdf(request, payment_pk=None):
    payment = get_object_or_404(ChecklistPayment, pk=payment_pk)
    return handle_download(request, payment.document)
예제 #8
0
파일: views.py 프로젝트: wuxxin/ecs
def invoice_pdf(request, invoice_pk=None):
    invoice = get_object_or_404(Invoice, pk=invoice_pk)
    return handle_download(request, invoice.document)
예제 #9
0
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)