from django.http import HttpResponse
import json

class JSONResponseMixin(object):
	def render_to_response(self, context):
		"""Returns a JSON response containing 'context' as payload"""
		return self.get_json_response(self.convert_context_to_json(context))

	def get_json_response(self, content, **httpresponse_kwargs):
		"""Construct an `HttpResponse` object."""
		return HttpResponse(content,
								 content_type='application/json',
								 **httpresponse_kwargs)

	def convert_context_to_json(self, context):
		"""Convert the context dictionary into a JSON object"""
		# Note: This is *EXTREMELY* naive; in reality, you'll need
		# to do much more complex handling to ensure that arbitrary
		# objects -- such as Django model instances or querysets
		# -- can be serialized as JSON.
		return json.dumps(context)


class AllowCORSMixin(object):

	def add_access_control_headers(self, response):
		response["Access-Control-Allow-Origin"] = "*"
		response["Access-Control-Max-Age"] = "1000"
		response["Access-Control-Allow-Headers"] = "X-Requested-With, Content-Type"
		return response
b7fa0c4f24acdd4140bfff8f4b2afe2c4e09fcf2
<mask token>


class JSONResponseMixin(object):
    <mask token>
    <mask token>

    def convert_context_to_json(self, context):
        """Convert the context dictionary into a JSON object"""
        return json.dumps(context)


class AllowCORSMixin(object):

    def add_access_control_headers(self, response):
        response['Access-Control-Allow-Origin'] = '*'
        response['Access-Control-Max-Age'] = '1000'
        response['Access-Control-Allow-Headers'
            ] = 'X-Requested-With, Content-Type'
        return response

<mask token>


class JSONResponseMixin(object):

    def render_to_response(self, context):
        """Returns a JSON response containing 'context' as payload"""
        return self.get_json_response(self.convert_context_to_json(context))
    <mask token>

    def convert_context_to_json(self, context):
        """Convert the context dictionary into a JSON object"""
        return json.dumps(context)


class AllowCORSMixin(object):

    def add_access_control_headers(self, response):
        response['Access-Control-Allow-Origin'] = '*'
        response['Access-Control-Max-Age'] = '1000'
        response['Access-Control-Allow-Headers'
            ] = 'X-Requested-With, Content-Type'
        return response

<mask token>


class JSONResponseMixin(object):

    def render_to_response(self, context):
        """Returns a JSON response containing 'context' as payload"""
        return self.get_json_response(self.convert_context_to_json(context))

    def get_json_response(self, content, **httpresponse_kwargs):
        """Construct an `HttpResponse` object."""
        return HttpResponse(content, content_type='application/json', **
            httpresponse_kwargs)

    def convert_context_to_json(self, context):
        """Convert the context dictionary into a JSON object"""
        return json.dumps(context)


class AllowCORSMixin(object):

    def add_access_control_headers(self, response):
        response['Access-Control-Allow-Origin'] = '*'
        response['Access-Control-Max-Age'] = '1000'
        response['Access-Control-Allow-Headers'
            ] = 'X-Requested-With, Content-Type'
        return response

from django.http import HttpResponse
import json


class JSONResponseMixin(object):

    def render_to_response(self, context):
        """Returns a JSON response containing 'context' as payload"""
        return self.get_json_response(self.convert_context_to_json(context))

    def get_json_response(self, content, **httpresponse_kwargs):
        """Construct an `HttpResponse` object."""
        return HttpResponse(content, content_type='application/json', **
            httpresponse_kwargs)

    def convert_context_to_json(self, context):
        """Convert the context dictionary into a JSON object"""
        return json.dumps(context)


class AllowCORSMixin(object):

    def add_access_control_headers(self, response):
        response['Access-Control-Allow-Origin'] = '*'
        response['Access-Control-Max-Age'] = '1000'
        response['Access-Control-Allow-Headers'
            ] = 'X-Requested-With, Content-Type'
        return response

from django.http import HttpResponse
import json

class JSONResponseMixin(object):
	def render_to_response(self, context):
		"""Returns a JSON response containing 'context' as payload"""
		return self.get_json_response(self.convert_context_to_json(context))

	def get_json_response(self, content, **httpresponse_kwargs):
		"""Construct an `HttpResponse` object."""
		return HttpResponse(content,
								 content_type='application/json',
								 **httpresponse_kwargs)

	def convert_context_to_json(self, context):
		"""Convert the context dictionary into a JSON object"""
		# Note: This is *EXTREMELY* naive; in reality, you'll need
		# to do much more complex handling to ensure that arbitrary
		# objects -- such as Django model instances or querysets
		# -- can be serialized as JSON.
		return json.dumps(context)


class AllowCORSMixin(object):

	def add_access_control_headers(self, response):
		response["Access-Control-Allow-Origin"] = "*"
		response["Access-Control-Max-Age"] = "1000"
		response["Access-Control-Allow-Headers"] = "X-Requested-With, Content-Type"
		return response