Reputation: 38
I'm in the process of writing a Django app, but I've hit a slight roadblock.
You see, I have the backend return an HTML page, and that works just fine. What I am having trouble with though is going the other way around. I am trying to call a function on the backend once the user clicks a button. Now, I've already searched to see if anyone else has asked this question before, but all the posts that came up had a different scenario linked to them. All of them were for GET requests, but I need to be able to POST some data instead.
Does anyone know how I can do this?
Upvotes: 2
Views: 56
Reputation: 14311
You'll want to get started with Django forms:
https://docs.djangoproject.com/en/3.0/topics/forms/
Forms accept a POST
, and there are lots of handy parts for sanitizing the data.
Upvotes: 1