I just started Django and I have a few fundamental questions about handling requests.
Say if I have two functions.
If I have a view, say
def test():
return render(request, 'form.html')
And in form.html I have a form with method="POST"
and action="/submitted/"
So now if I want to do something with the submitted data of the form, am I supposed to do it in the same test()
view or do I have to do it in another view which would handle the `/submitted/ URL?
I've been doing it with the latter but then I read this:
Need a minimal Django file upload example.
Here, in the 4th point about views.py
, they've made the form in the same view as they've handled the form.
How does that work? It seems very unintuitive. Or am I missing something?