[Fixed]-Django – Loading dynamic Templates

1👍

yes it will work, just you need to send dynamic image date from View while calling this snippent. put following detail in proper path only.

{% include “stories/Princess_Run_Story/Princess_Run_Story.html” %}

Alternate Option:
Actually just call Ajax on click of button and prepare image date in snippet through backend and send snippet on Ajax success
Like below code in javascript:

there $('.container').html(snippet_data)

in backend:

render_data = {'image_data': image_data}
t = loader.get_template('stories/Princess_Run_Story/Princess_Run_Story.html')
html = t.render(RequestContext(request, render_data))
return HttpResponse(json.dumps({'html': html}), 'application/json')

Leave a comment