InvManage.views.product_views
Module Contents
Functions
|
Creates a product on |
|
Updates a product on |
|
Deletes the product with primary key |
|
Retrieves the list of products on |
|
Imports products into database from a |
- InvManage.views.product_views.create_product_view(request)
Creates a product on
POSTrequest, and returns a product creation form onGETrequest.- GET /product
Gets the product creation form.
Example request:
GET /product/ HTTP/1.1 Host: localhost:8000 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/html; charset=utf-8
- POST /product
Creates a product.
Example request:
POST /product/ HTTP/1.1 Host: localhost:8000 Content-Type: multipart/form-data;
- Form Parameters
basic-name –
Yamaha FS100C Acoustic Guitarbasic-item_type –
Black Acoustic Guitarbasic-category –
Musical Instrumentbasic-description –
Top: Spruce back/sides, Mahogany neck, Nato fret board, Rosewood bridge, Snorkeling frets: 20, Open chrome tuners, Finishes: Blackdetailed-length –
1056detailed-width –
376detailed-height –
140detailed-weight –
3.2storage-barcode –
036000029145storage-expiry –
2040-09-29status-quantity –
20status-identifier –
FS100Cstatus-location –
BAY004pricing-price –
9990pricing-discount –
7
- Response Headers
Content-Type – multipart/form-data; boundary=—-WebKitFormBoundaryLTR88aZAnBUSE7mv
- Status Codes
302 Found – Redirects to
/product.
- InvManage.views.product_views.update_product_view(request)
Updates a product on
POSTrequest and returns the product update form onGETrequest.- GET /product/update
Gets the product update form whose primary key matches the query parameter
pk.Example request:
GET /product/update HTTP/1.1 Host: localhost:8000 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
- Query Parameters
pk – The primary key of the product.
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/html; charset=utf-8
- POST /product/update
Updates the product.
Example request:
POST /product/update HTTP/1.1 Host: localhost:8000 Content-Type: multipart/form-data;
- Form Parameters
pk –
778basic-name –
Yamaha FS100C Acoustic Guitarbasic-item_type –
Black Acoustic Guitarbasic-category –
Musical Instrumentbasic-description –
Top: Spruce back/sides, Mahogany neck, Nato fret board, Rosewood bridge, Snorkeling frets: 20, Open chrome tuners, Finishes: Blackdetailed-length –
1056detailed-width –
376detailed-height –
140detailed-weight –
3.2storage-barcode –
036000029145storage-expiry –
2040-09-29status-quantity –
20status-identifier –
FS100Cstatus-location –
BAY004pricing-price –
9990pricing-discount –
7
- Response Headers
Content-Type – multipart/form-data; boundary=—-WebKitFormBoundaryLTR88aZAnBUSE7mv
- Status Codes
302 Found – Redirects to
/product.
- InvManage.views.product_views.delete_product_view(request, pk)
Deletes the product with primary key
product_idonPOSTrequest.- POST /product/<str:product_id>/delete
Deletes the consumer represented by the primary key
product_id.Example request:
POST /product/778/delete HTTP/1.1 Host: localhost:8000 Content-Type: application/x-www-form-urlencoded
- Parameters
product_id – Product primary key.
- Response Headers
Content-Type – application/x-www-form-urlencoded
- Status Codes
302 Found – Redirects to
/product.500 Internal Server Error – Prodcut matching query does not exist.
- InvManage.views.product_views.display_products_view(request)
Retrieves the list of products on
GETrequest.- GET /products/
Gets the list of all products.
Example request:
GET /products/ HTTP/1.1 Host: localhost:8000 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
- Form Parameters
page – The page number of the products list.
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/html; charset=utf-8
- InvManage.views.product_views.uploadCSV(request, data)
Imports products into database from a
.csvfile onPOSTrequest. CSV template columns:name,category,item_type,description,price,quantity,identifier,location,length,width,height,weight,discount,barcode,expiry.