> On 2013-05-11, at 15:57 , Larry Martell wrote:
>>
>> Yes, that is what I did. This is not in my urlconf. It's in a view
>> function. I replaced:
>>
>> return direct_to_template(request, template)
>>
>> by:
>>
>> return TemplateView.as_view(template_name=template)
>>
>> Is that not correct?
>
> Indeed not, `TemplateView.as_view(template)` is roughly equivalent to
> `functools.partial(direct_to_template, template=template)`: it's only
> one half of the operation, which returns a callable replying to
> requests.
>
> You need something along the lines of `TemplateView.as_view(template)(request)`
I am running into this same problem with RedirectView. In 1.4 I had a
view that was doing:
return redirect_to(request, new_report.url)
I changed it to:
return RedirectView.as_view(url=new_report.url)
and it's blowing up with:
Traceback:
File "/Library/Python/2.7/site-packages/django/core/handlers/base.py"
in get_response
187. response = middleware_method(request, response)
File "/Library/Python/2.7/site-packages/django/contrib/sessions/middleware.py"
in process_response
26. patch_vary_headers(response, ('Cookie',))
File "/Library/Python/2.7/site-packages/django/utils/cache.py" in
patch_vary_headers
142. if response.has_header('Vary'):
I tried doing something similar to what you suggested with
TemplateView, but that didn't work:
RedirectView.as_view(url=new_report.url)(request)
*** TypeError: a float is required