Opened 9 years ago
Closed 9 years ago
#27517 closed Bug (fixed)
TemplateResponseMixin with charset does not work
| Reported by: | Kosei Kitahara | Owned by: | nobody | 
|---|---|---|---|
| Component: | Generic views | Version: | 1.10 | 
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description (last modified by )
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.
Change History (5)
comment:1 by , 9 years ago
| Description: | modified (diff) | 
|---|
comment:2 by , 9 years ago
| Description: | modified (diff) | 
|---|
comment:3 by , 9 years ago
| Summary: | TemplateResponseMixin with charset does not worked → TemplateResponseMixin with charset does not work | 
|---|
comment:4 by , 9 years ago
| Has patch: | set | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
  Note:
 See   TracTickets
 for help on using tickets.
    
PR