更新时间:2022-12-12 15:16:41
我想你把保存文件的视图写入db?
I guess you wrote the view like save file into db ?
那么这里是答案将帮助你最后插入 id
在html页面
then here is the answer will help you to get last inserted id
in html page
首先写两个视图(请求)。
First write two view(request).
其中文件处理
并获取 id
where file handling
and get the id
like:
def view_second(request)
if request.method == 'POST':
if form valid:
#get file here
new.save()
msg = new.id
return HttpResponse(msg)
就是这样,现在在你的html之后的dropzone脚本..
And that's it, Now in your html after the dropzone script ..
Dropzone.options.myDropzone = {
init: function() {
this.on("success", function(file, response) {
#alert(response)
});
所以在回复中你会得到 id
so in the response you will get the id