<s> from . version import DJANGO_VERSION , DJ18 , DJ17 , DJ16 , DJ19 <EOL> from django . conf import settings <EOL> try : <EOL> settings . configure ( ) <EOL> except RuntimeError : <EOL> pass <EOL> if DJANGO_VERSION < DJ17 : <EOL> import json <EOL> from django . http import HttpResponse <EOL> class JsonResponse ( HttpResponse ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , content , mimetype = '<STR_LIT:application/json>' , status = None , content_type = None , ** kwargs ) : <EOL> super ( JsonResponse , self ) . __init__ ( <EOL> content = json . dumps ( content ) , <EOL> mimetype = mimetype , <EOL> status = status , <EOL> content_type = content_type , <EOL> ) <EOL> else : <EOL> from django . http import JsonResponse <EOL> if DJANGO_VERSION < DJ19 : <EOL> from django . template . base import TagHelperNode , parse_bits <EOL> else : <EOL> from django . template . library import TagHelperNode , parse_bits <EOL> if DJANGO_VERSION >= DJ18 : <EOL> from django . template import Engine <EOL> get_template_from_string = Engine . get_default ( ) . from_string <EOL> else : <EOL> from django . template . loader import get_template_from_string <EOL> if DJANGO_VERSION < DJ17 : <EOL> from django . forms . util import flatatt , format_html <EOL> else : <EOL> from django . forms . utils import flatatt , format_html <EOL> def get_cache ( cache ) : <EOL> if DJANGO_VERSION < DJ17 : <EOL> from django . core . cache import get_cache <EOL> return get_cache ( cache ) <EOL> else : <EOL> from django . core . cache import caches <EOL> return caches [ cache ] </s>
