```
class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return self.render_to_response(context,
charset=kwargs.get('charset', 'utf-8'))
```
`TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
__init__` with a `charset` keyword argument.
But above method passed charset which is none-keyword argument.
Also `content_type` and `status` are same too.
--
Ticket URL: <https://code.djangoproject.com/ticket/27517>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> When create class based view which contain `TemplateResponseMixin`,
>
> ```
> class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
> def get(self, request, *args, **kwargs):
> context = self.get_context_data(**kwargs)
> return self.render_to_response(context,
> charset=kwargs.get('charset', 'utf-8'))
> ```
>
> `TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
> __init__` with a `charset` keyword argument.
> But above method passed charset which is none-keyword argument.
> Also `content_type` and `status` are same too.
New description:
When create class based view which contain `TemplateResponseMixin`,
{{{
class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return self.render_to_response(context,
charset=kwargs.get('charset', 'utf-8'))
}}}
`TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
__init__` with a `charset` keyword argument.
But above method passed charset which is none-keyword argument.
Also `content_type` and `status` are same too.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:1>
Old description:
> When create class based view which contain `TemplateResponseMixin`,
>
> {{{
> class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
> def get(self, request, *args, **kwargs):
> context = self.get_context_data(**kwargs)
> return self.render_to_response(context,
> charset=kwargs.get('charset', 'utf-8'))
> }}}
>
> `TemplateResponseMixin.render_to_response` call `SimpleTemplateResponse.
> __init__` with a `charset` keyword argument.
> But above method passed charset which is none-keyword argument.
> Also `content_type` and `status` are same too.
New description:
When create a class based view which contain `TemplateResponseMixin`,
{{{
class MyTemplateView(TemplateResponseMixin, ContextMixin, View):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
return self.render_to_response(context,
charset=kwargs.get('charset', 'utf-8'))
}}}
`TemplateResponseMixin.render_to_response` calls `SimpleTemplateResponse.
__init__` with a `charset` keyword argument.
But, the above method passed `charset` as a non-keyword argument.
In addition, `content_type`, `status` are passed also as nonーkeyword
arguments, which seems in a wrong order.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:2>
--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:3>
* has_patch: 0 => 1
* stage: Unreviewed => Accepted
Comment:
[https://github.com/django/django/pull/7588 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"f095b249baf34bbdd4c0b28c9bde05b4d20681be" f095b249]:
{{{
#!CommitTicketReference repository=""
revision="f095b249baf34bbdd4c0b28c9bde05b4d20681be"
Fixed #27517 -- Fixed charset param in SimpleTemplateResponse.__init__().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27517#comment:5>