The event application contains pages to create events in EMERGEN-DB.
The event application contains 2 template :
event_list.html: event page where the list of events is returned
event_new.html: stat page where a new event is created and returned
Key files of the « event » application¶
The function « event_list » returns a rendered HTML template for displaying a list of events.
request – The request parameter is an object that represents the HTTP request made by the client. It contains information about therequest, such as the HTTP method (GET, POST, etc.), headers, user session, and any data sent with the request. In this case, the request object is
a rendered HTML template called « event_list.html ».
The function event_new is a view function that handles the creation of a new event object in a web application.
request – The request parameter is an object that represents the HTTP request made by the user. It contains information about the request, such as the method used (GET or POST), the user making the request, and any data sent with the request. In this code, the request object is used
an HTTP response redirect to the “event_list” URL if the request method is POST and the form is valid. If the request method is not POST, it returns a rendered HTML template “event/event_new.html” with the form as context.