Note: You can find the implementation of these views in the nationality_view.py file.
The NationalityListView
displays a paginated list of all nationalities available in the system.
- URL:
/mobiles/nationality/
- HTTP Method:
GET
- Name:
mobiles:nationality-list
- Template:
mobiles/nationality/list.html
- Retrieves all nationalities from the database.
- Paginates the list to display 10 nationalities per page.
- Renders the
list.html
template with the paginated data.
The NationalityCreateView
provides functionality to create a new nationality.
- URL:
/mobiles/nationality/create/
- HTTP Method:
GET
,POST
- Name:
mobiles:nationality-create
- Template:
mobiles/nationality/form.html
- Form:
NationalityForm
- Renders an empty
NationalityForm
for creating a new nationality. - On successful form submission, saves the new nationality to the database and redirects to the
Nationality List View
. - If the form submission is invalid, re-renders the
form.html
template with the populated form and error messages.
The NationalityUpdateView
provides functionality to update an existing nationality.
- URL:
/mobiles/nationality/update/<int:pk>/
- HTTP Method:
GET
,POST
- Name:
mobiles:nationality-update
- Template:
mobiles/nationality/form.html
- Form:
NationalityForm
- Retrieves the nationality with the given
pk
from the database. - Renders a populated
NationalityForm
with the retrieved nationality for updating. - On successful form submission, saves the updated nationality to the database and redirects to
the
Nationality List View
. - If the form submission is invalid, re-renders the
form.html
template with the populated form and error messages.
The NationalityDeleteView
provides functionality to delete an existing nationality.
- URL:
/mobiles/nationality/delete/<int:pk>/
- HTTP Method:
POST
- Name:
mobiles:nationality-delete
- Retrieves the nationality with the given primary key (
pk
) from the database. - Deletes the retrieved nationality from the database.
- Redirects to the
Nationality List View
after successful deletion.