Application event¶
The event application contains pages to create events in EMERGEN-DB.
Templates¶
The event application contains 2 template :
event_list.html
: event page where the list of events is returnedevent_new.html
: stat page where a new event is created and returned
Key files of the « event » application¶
admin.py¶
models.py¶
tests.py¶
view.py¶
- apps.event.views.event_list(request)¶
The function « event_list » returns a rendered HTML template for displaying a list of events.
- Paramètres
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
- Renvoie
a rendered HTML template called « event_list.html ».
- apps.event.views.event_new(request)¶
The function event_new is a view function that handles the creation of a new event object in a web application.
- Paramètres
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
- Renvoie
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.