Re: form doesn't validate when trying to upload file

2012-09-10 Thread mapapage
After some testing i think that the prob occurs because from the same view I render another one form in the same template. This form is not multi-part. In this case it happens what I describe. If i put this simple form in comments (in views and in template) the multipart form uploads the file n

Re: form doesn't validate when trying to upload file

2012-09-10 Thread mapapage
> > I'm running it on the django development server. I changed the header and > it behaves the same way. Is that expected or not? > I also tried print request.FILES and I get , but after > i tried print request.raw_post_data and it seems that the name of the file > that i try to upload is incl

Re: form doesn't validate when trying to upload file

2012-09-10 Thread Kurtis Mullins
Sorry about that. I accidentally over-looked where you mentioned that in your email. Are you running this on a debug server? Also, can you try replacing your template code with a simple {% csrf_token %}{{ form }} and see if that makes any differences? On Mon, Sep 10, 2012 at 10:38 AM, mapapage w

Re: form doesn't validate when trying to upload file

2012-09-10 Thread mapapage
> > I have it like this, with filefield, in my first question I'm just posting > the generated model from inspectdb and underneath I'm saying that I change > it to FileField.. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this dis

Re: form doesn't validate when trying to upload file

2012-09-10 Thread Kurtis Mullins
ahh, sorry I just saw something that might help. Try making this change: docpath = models.CharField(max_length=200) to: docpath = models.FileField(...) # Check the docs for arguments to this Field. https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield On Mon, Sep 10, 2012 at 8:41 A

Re: form doesn't validate when trying to upload file

2012-09-10 Thread mapapage
> > as I say in my last reply, I include the multi part header and it doesn't > work! :( What else I can try? > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-us

Re: form doesn't validate when trying to upload file

2012-09-09 Thread Kurtis Mullins
Also, don't forget the multi-part in your template: On Sun, Sep 9, 2012 at 2:29 PM, Joseph Mutumi wrote: > I'm assuming you are using the forms.ModelForm for your model? Say > LicenceForm? > > class LicenseForm(forms.ModelForm): > class Meta: > model = License > > According to the d

Re: form doesn't validate when trying to upload file

2012-09-09 Thread mapapage
Yes, exactly I'm using a modelform and in my views I'm doing: def upload(request): if "doc-form" in request.POST: docform = LicenceForm(data=request.POST, files=request.FILES) if docform.is_valid(): docform.save() return render_to_response('bingo.html',

Re: form doesn't validate when trying to upload file

2012-09-09 Thread Joseph Mutumi
I'm assuming you are using the forms.ModelForm for your model? Say LicenceForm? class LicenseForm(forms.ModelForm): class Meta: model = License According to the doc you have to pass all relevant QueryDicts to the form __init__ when you are creating a bound instance. In a nutshell make

form doesn't validate when trying to upload file

2012-09-09 Thread mapapage
Hi! It's my first time trying to achieve the ''file upload functionality' and I need your help. I'm working on a legacy db and I'm supposed to do the file upload in a table that gets created this way: CREATE TABLE "LICENCE" ("ID" NUMBER NOT NULL ENABLE, "VEH_ID" NUMBER NOT NULL