'Pickling support function.
Ensures that the object can\'t be pickled before it has been
rendered, and that the pickled state only includes rendered
data, not the data used to construct the response.'

def __getstate__(self):

    obj_dict = self.__dict__.copy()
    if (not self._is_rendered):
        raise ContentNotRenderedError('The    response    content    must    be    rendered    before    it    can    be    pickled.')
    del obj_dict['template_name']
    del obj_dict['context_data']
    del obj_dict['_post_render_callbacks']
    return obj_dict
