TemplateView does not support setting mime type, like views.generic.simple.direct_to_template did
|Reported by:||gwahl@…||Owned by:||nobody|
|Cc:||bmispelon@…, mail@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I use direct_to_template to serve my robots.txt, like this:
urlpatterns = patterns('', url('^robots.txt$', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')), ...
In Django 1.5 this is no longer possible, because the function-based generic views are removed, and TemplateView does not have a mime/content type argument.
I think that a content_type argument should be added to TemplateView to add the same functionality that was in the function-based view. Patch to come.
Change History (15)
comment:1 Changed 3 years ago by gwahl@…
- Has patch set
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 3 years ago by aaugustin
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Uncategorized to Bug
comment:11 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>
- Resolution set to fixed
- Status changed from new to closed