On 24 June 2011 17:36, raj <[email protected]> wrote:
> <snip>
> def upload_view(request):
> user = request.user
> if user.is_authenticated():
> if request.method == 'POST':
> form =upload_form(request.POST, request.FILES, user)
> if form.is_valid():
> file_instance = upload_model()
> saved_file = handle_uploads(request, ['doc'])
> #request.POST.get('title'))
> for f in saved_file:
> setattr(file_instance, f[0])
> file_instance.save()
> return HttpResponseRedirect('/user/update/success/')
> else:
> form = upload_form()
> return render_to_response('/home/oneadmin/webapps/oneadmin/
> oneadmin/templates/oneadmissions/documents.html', {'form':form},
> context_instance = RequestContext(request))
>
> my urls.py file has a url that links to the upload_view. I just cant
> seem to find why the file isn't uploading. Whenever I try to upload
> something, it just refreshes the page and states that the given fields
> are required (even though I entered all the information). Help please.
>
>
It looks to me like form.is_valid() is returning False, so you're seeing the
error messages.
You can debug the cause by putting
import pdb;pdb.set_trace()
just above the "if form.is_valid():" line and then stepping through the
validation code in the debugger.
Malcolm
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.