Sorry ignore this.

Changed from:
form = PdfForm(
            initial ={
                'name': pdf.name,
                'description': pdf.description,
                'file': pdf.file,
            }
        )

to:
form = PdfForm(instance = pdf)

and it works fine.


On 23 Set, 17:43, Federico Capoano <nemesis.des...@libero.it> wrote:
> Hello to all,
>
> maybe is something really silly, but I don't get it.
>
> I'm using ModelForm to edit a database object that has a file input.
>
> The <form> tag has enctype="multipart/form-data" and the view uses
> request.FILES.
>
> I can add and edit files without problems, but there is a case in
> which editing a file does not work:
> when I don't want to change the file I simply leave the field blank
> and I get a validation error saying that the file field is required.
>
> What am I missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to