我想使用 django-filetransfer 在管理员中上传一个文件,到目前为止,我已经覆盖了 admin.ModelAdmin 中的 render_change_form 方法。我错过了什么?
def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
upload_url,upload_data = prepare_upload(request, request.path)
context['upload_url'] = upload_url
context['upload_data'] = upload_data
return admin.ModelAdmin.render_change_form(self, request, context,
add=add, change=change, form_url=upload_url, obj=obj)