On Monday, 3 October 2011 13:17:49 UTC+1, Victor Hooi wrote:
>
> heya,
>
> I was previously using the following to render a form:
>
> from django.shortcuts import render_to_response, RequestContext
> ...
> def upload_file(request):
> ...
> return render_to_response('upload_form.html', {'form': form}, 
> context_instance=RequestContext(request))
>
> I can confirm that this works fine, form was rendered perfectly fine.
>
> However, I read that render() is now the bee-knees...lol (
> http://stackoverflow.com/questions/5154358/django-what-is-the-difference-between-render-render-to-response-and-direct),
>  
> so I thought I'd switch to that:
>
> from django.shortcuts import render
> ...
> def upload_file(request):
> ...
> return render('upload_form.html', {'form': form})
>
>
> However, when I try to do that, I get an error:
>
> <snip>
>
 

> Exception Type: AttributeError at /upload/
> Exception Value: 'str' object has no attribute 'META'
>
>
> Any idea from the above why this might be happening?
>
> Thanks,
> Victor
>

The first argument to `render` is the request.
https://docs.djangoproject.com/en/1.3/topics/http/shortcuts/#render
--
DR. 
 

-- 
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-users/-/8qPIxvv9rOwJ.
To post to this group, send email to django-users@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