I have a method in views.py that creates an image and also creates a text string to return to a template for display.
This code shows just the image correctly(without the string showing up since not returned):
response = HttpResponse(content_type='image/png')
image.save(response, "PNG")
return response
This code doesn't quite work right as it just displays text (the PIL photo object text string, the string is displayed correctly)
objects_to_render = {"photo":image,"string":the_string}
return render(request, "pic_text_display.html",objects_to_render, content_type='image/png')
In "pic_text_display.html":
How can I return an image and have the string available for display in the template at the same time?
Thanks for the help!!
Aucun commentaire:
Enregistrer un commentaire