我还在学习 Django,还有很多我不知道的地方。问题是我无法将 .pdf(或任何其他格式)通过 ajax post 方法发送到外部 API。所以在接收端我只得到文件的字符串位置而不是实际文件。我已将以下 javascript 代码放在generic_list_items_subtemplate.html 中{% load i18n %}{% load static %}{% load common_tags %}{% load navigation_tags %}<div class="row"> <div class="col-xs-12"> <h4> {% if page_obj %} {% if page_obj.paginator.num_pages != 1 %} {% blocktrans with page_obj.start_index as start and page_obj.end_index as end and page_obj.paginator.object_list|length as total and page_obj.number as page_number and page_obj.paginator.num_pages as total_pages %}Total ({{ start }} - {{ end }} out of {{ total }}) (Page {{ page_number }} of {{ total_pages }}){% endblocktrans %} {% else %} {% blocktrans with page_obj.paginator.object_list|length as total %}Total: {{ total }}{% endblocktrans %} {% endif %} {% else %} {% blocktrans with object_list|length as total %}Total: {{ total }}{% endblocktrans %} {% endif %} </h4> <hr> <div class="well center-block"> <div class="clearfix"> <div class="pull-right"> <form action="{% url 'common:multi_object_action_view' %}" class="form-multi-object-action" method="get"> {% if object_list %}在接收方我得到name = "file"value = "/documents/12/preview/"但我想获取文件而不是这个字符串。我不知道如何定位文件以直接发送。
添加回答
举报
0/150
提交
取消