o when user send request to access a certain url, it will tell user urls on django to go…
Jump to turn (12)
- 1o when user send request to access a certain url, it will tell user urls on djan
- 2how about when user click a button to save information on server side? for examp
- 3remove ajax from it, just html,css,javascript,django
- 4so in this instance, I will return a http response back to the client after they
- 5how about url on view, I'm not quite understand that, from what I understand, a
- 6hmm, so like, there's an area on django that say post request, which will map bu
- 7so each view can only get 1 function for post and get, but not like it will map
- 8yeah but I mean, you divide post request into one part and get into another, but
- 9but it does map specific function like render request though?
- 10no but, for post request, how does it know what function to use
- 11but how do it know to run myview
- 12so if I have multiple button, it should be in 1 form only?
- User
o when user send request to access a certain url, it will tell user urls on django to go to that specific function in views, then views will have a function that render html to display the page?
- Assistant
Yes, that is correct. In Django, when a user sends a request to access a specific URL, the URL is matched with a pattern defined in the URL configuration file (urls.py). This file maps URLs to specific view functions in the views.py file.
The view function associated with the URL is responsible for processing the request and returning an HTTP response. This response can be rendered HTML content using Django's template system or can be any other type of response like JSON, XML, etc.
So, when a user accesses a URL, Django matches the URL to a view function, which then renders the appropriate HTML page to display the content.
- User