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