python - How to receive uploaded file from the inlined form in django? -


I am trying to create a "cool" image uploading interface in the django admin panel. The problem is that I am using inline interface to upload image instances, but I am using jQuery Ajax form to upload images, so I need to create another form to upload . And now Django Scene Function can not get request.FILES from this form because I created it without using django.forms And can not be specified in the visual function that is required to be used. So I can not override the standard view function for the inline interface and this form can not be made using django.forms . Then this code does not appear to be working:

My form:

  & lt; Form id = "uploadform" enctype = "multipart / form-data" method = "post" action = "upload_pictures /" & gt; & Lt; Input type = "file" name = "file" /> & Lt; Input type = "submit" value = "upload" / & gt; & Lt; / Form & gt;  

My view function:

  def upload_picture (request): if request.method == 'POST': save_original (request.FILES ['file'  

Maybe I should do it completely differently?

"post-text "Itemsprop =" text ">

request.FILES should work fine with that handmade form.In addition to adding id =" id_file ", the diffen does not separate anything with the field. I'm absolutely certain that you have Is not an id In the FILES. [5]: DJ ango import forms [6]: Category Generic File Form (Form.Form): ...: file = forms.FileField () ...: in [ 7]: G = Generic file format (): [8]: Print G & LT; TR & T for the label

  • Gt; TR;

  • Comments

    Popular posts from this blog

    sql - dynamically varied number of conditions in the 'where' statement using LINQ -

    asp.net mvc - Dynamically Generated Ajax.BeginForm -

    Debug on symbian -