#19076: TemplateView does not support setting mime type, like
views.generic.simple.direct_to_template did
-------------------------------+------------------------------------
Reporter: gwahl@… | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Comment (by aaugustin):
The root cause is that `TemplateView` uses two sets of keyword arguments
to render itself:
- `**kwargs` => they're merged in the context by `get_context_data`, and
they can be passed in the call to `as_view()`
- `**response_kwargs` => they're used in `render_to_response` to
instantiate the response class, but currently they can't be passed without
defining a subclass, hence the problem.
----
`HttpResponseBase` takes two arguments: `content_type` and `status` (plus
`mimetype`, a deprecated alias for `content_type`).
`TemplateView` implies `status = 200`: otherwise one would use a different
class like `RedirectView`.
So, the only remaining argument accepted by all `HttpResponseBase`
subclasses is `content_type`, and it makes ''some'' sense to special-case
it.
--
Ticket URL: <https://code.djangoproject.com/ticket/19076#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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 https://groups.google.com/groups/opt_out.