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
POST
request, and returns a product creation form onGET
request.- 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 Guitar
basic-item_type –
Black Acoustic Guitar
basic-category –
Musical Instrument
basic-description –
Top: Spruce back/sides, Mahogany neck, Nato fret board, Rosewood bridge, Snorkeling frets: 20, Open chrome tuners, Finishes: Black
detailed-length –
1056
detailed-width –
376
detailed-height –
140
detailed-weight –
3.2
storage-barcode –
036000029145
storage-expiry –
2040-09-29
status-quantity –
20
status-identifier –
FS100C
status-location –
BAY004
pricing-price –
9990
pricing-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
POST
request and returns the product update form onGET
request.- 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 –
778
basic-name –
Yamaha FS100C Acoustic Guitar
basic-item_type –
Black Acoustic Guitar
basic-category –
Musical Instrument
basic-description –
Top: Spruce back/sides, Mahogany neck, Nato fret board, Rosewood bridge, Snorkeling frets: 20, Open chrome tuners, Finishes: Black
detailed-length –
1056
detailed-width –
376
detailed-height –
140
detailed-weight –
3.2
storage-barcode –
036000029145
storage-expiry –
2040-09-29
status-quantity –
20
status-identifier –
FS100C
status-location –
BAY004
pricing-price –
9990
pricing-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_id
onPOST
request.- 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
GET
request.- 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
.csv
file onPOST
request. CSV template columns:name
,category
,item_type
,description
,price
,quantity
,identifier
,location
,length
,width
,height
,weight
,discount
,barcode
,expiry
.