AttributeError: can't set attribute

后端 未结 3 688
夕颜
夕颜 2021-01-03 21:55

I am working on a legacy django project, in there somewhere there is a class defined as follows;

from django.http import HttpResponse

class Response(HttpRes         


        
3条回答
  •  天命终不由人
    2021-01-03 22:34

    It looks like you don't use self.template in Response class. Try like this:

    class Response(HttpResponse):
        def __init__(self, template='', calling_context='' status=None):
            HttpResponse.__init__(self, get_template(template).render(calling_context), status)
    

提交回复
热议问题