JSONResponseMixin overrides the content_type of TemplateView in Django 1.6 #94

kitsunde opened this Issue Jan 2, 2014 · 1 comment


None yet

3 participants

kitsunde commented Jan 2, 2014

This happens because of django/django@23e319d it effectively means that TemplateView and JSONResponseMixin doesn't.. well.. mix.

I would suggest renaming content_type -> content_type_json, get_content_type -> get_content_type_json which would make it consistent with the names of the other methods. But that change would need a deprecation policy, so a design decision is needed. :)

For those of you that want to do this anyways, you can get away with this:

from braces.views import JSONResponseMixin as BracesJSONResponseMixin
class JSONResponseMixin(BracesJSONResponseMixin)
    content_type = None
    def get_content_type(self):
        return 'application/json'

Then just swap out your JSONResponseMixins.


I think your suggestion is a good one, but, you're right, it probably needs a deprecation policy. We'll see if it's possible to do it in a backwards-compatible way, and, if not, we'll mark things for deprecation starting in 1.4.0.

@chrisjones-brack3t chrisjones-brack3t modified the milestone: 1.4 Mar 1, 2014
@kennethlove kennethlove modified the milestone: 1.4 Mar 1, 2014
@kennethlove kennethlove added a commit that referenced this issue Mar 4, 2014
@kennethlove kennethlove fix #94 de72889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment