0

I have gone through the answer at Execute code in Django after response has been sent to the client but I am having difficulty in sending html request. The web page is not loading. It is just only showing the string of the url i am requesting e.g. url/template.html

This is what I have done and it keeps on sending a json response instead of an html

class ResponseAfter(Response):
    def __init__(self, data, then_callback, **kwargs):
        super().__init__(data, **kwargs)
        self.then_callback = then_callback

    def close(self):
        super().close()
        self.then_callback()
    
def followingFunction():
    #this is the function that would be executed afterward

page_result=

return ResponseAfter((request,'index.html'),
        followingFunction, content_type ="text/html")
        

Please how can I get the function to send the report

update

I have seen my mistake. I added render to the return statement and it worked fine.

jarhead
  • 9
  • 3

0 Answers0