Opened 8 years ago

Last modified 8 years ago

#27517 closed Bug

TemplateResponseMixin with charset does not worked — at Version 2

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 Kosei Kitahara)

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 (2)

comment:1 by Kosei Kitahara, 8 years ago

Description: modified (diff)

comment:2 by Kosei Kitahara, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top