I'm currently generating an image via matplotlib using the properties of an object, and am able to create a view that displays said image in a HttpResponse. I used the following snippet to do so: http://wiki.scipy.org/Cookbook/Matplotlib/Django. I've also configured my URLs to both generate and display the image successfully when I navigate to domain.com/objectID.png
Right now I want to create a form, whose inputs will be used to generate an image from matplotlib. Then I want to display this generated image back to the user on the same page of the form.
How should I feed the inputs of the form to my matplotlib image generator, and then display the resulting image back to the user?
Thank you very much for your help.
Best regards
EDIT 1: I was looking for a solution, and I believe I would display the image as follows in my template. Not sure how to feed the variable 'img' though:
{% if img %} <img border="0" alt="My Generated Image" src="{{ img }}" /> {% endif %}