I have a simple upload function in Python which I have put in my views.py.
def upload():
global original_img,img,img2,img3,image_path,old_label_image,photo,label,image_path,image,ax,fig
print "upload"
image_path=tkFileDialog.askopenfilename()
image = Image.open(image_path)
original_img= image.copy()
image.thumbnail((1000,625))
photo = ImageTk.PhotoImage(image)
label = Label(image=photo)
label.image = photo
if old_label_image is not None:
old_label_image.destroy()
old_label_image = label
label.pack()
I want this function to be called onclick of a button from an html template file(current.html) in Django.
<button> Upload from PC</button>
How do I call the view function on click of the button in HTML? Also do I have to make any changes in URLConfs for this? Please help