InvManage.views.consumer_views
Module Contents
Functions
|
Creates a consumer on |
|
Updates a consuemr on |
|
Deletes the consumer with primary key |
|
Retrieves the list of consumers on |
|
Returns the |
- InvManage.views.consumer_views.create_consumer_view(request)
Creates a consumer on
POST
request, and returns a consumer creation form onGET
request.- GET /consumer
Gets the consumer creation form.
Example request:
GET /consumer/ 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 /consumer
Creates a consumer.
Example request:
POST /consumer/ HTTP/1.1 Host: localhost:8000 Content-Type: multipart/form-data;
- Form Parameters
consumer-name –
The Music Store
consumer-identifier –
CONS1256
consumer-gstin –
89ACC654654335
consumer-phone –
+91 6543525422
consumer-address –
Plot no. 958, N-4, Neo Complex, Barh, Wokha, Nagaland, 797111
consumer-email –
johnDoe@themusic.store
consumer-location –
Wokha
- Response Headers
Content-Type – multipart/form-data; boundary=—-WebKitFormBoundaryLTR88aZAnBUSE7mv
- Status Codes
302 Found – Redirects to
/consumer
.
- InvManage.views.consumer_views.update_consumer_view(request)
Updates a consuemr on
POST
request and returns the consumer update form forGET
request.- GET /consumer/update
Gets the consumer update form whose primary key matches the query parameter
pk
.Example request:
GET /consumer/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 consumer.
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/html; charset=utf-8
- POST /consumer/update
Updates the consumer.
Example request:
POST /company/update HTTP/1.1 Host: localhost:8000 Content-Type: multipart/form-data;
- Form Parameters
pk –
7
consumer-name –
The Music Store
consumer-identifier –
CONS1256
consumer-gstin –
89ACC654654335
consumer-phone –
+91 6543525422
consumer-address –
Plot no. 958, N-4, Neo Complex, Barh, Wokha, Nagaland, 797111
consumer-email –
johnDoe@themusic.store
consumer-location –
Wokha
- Response Headers
Content-Type – multipart/form-data; boundary=—-WebKitFormBoundaryLTR88aZAnBUSE7mv
- Status Codes
302 Found – Redirects to
/consumer
.
- InvManage.views.consumer_views.delete_consumer_view(request, pk)
Deletes the consumer with primary key
pk
onPOST
request.- POST /consumer/<str:object_id>/delete
Deletes the consumer represented by the primary key
object_id
.Example request:
POST /consumer/5/delete HTTP/1.1 Host: localhost:8000 Content-Type: application/x-www-form-urlencoded
- Parameters
object_id – Consumer primary key.
- Response Headers
Content-Type – application/x-www-form-urlencoded
- Status Codes
302 Found – Redirects to
/consumer
.500 Internal Server Error – Consumer matching query does not exist.
- InvManage.views.consumer_views.display_consumers_view(request)
Retrieves the list of consumers on
GET
request.- GET /consumers/
Gets the list of all consumers.
Example request:
GET /companies/ 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 consumers list.
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: text/html; charset=utf-8
- InvManage.views.consumer_views.get_consumer(request)
Returns the
JSON
serialized data of the requested consumer onGET
request.- GET /get_consumer/
Gets the JSON serialized data of the requested consumer.
Example request:
GET /get_consumer/ 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: application/json; charset=utf-8 [ { "name": "The Music Store", "identifier": "CONS1256", "gstin": "89AAC4633353643", "phone": "+91 8325642358", "address": "Plot no 958, N- 4, Neo Complex, Barh, Wokha, Nagaland, 797111", "email": "JohnDoe@themusic.store", "location": "Wokha" } ]
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – List of consumers received successfully.
400 Bad Request – Bad request version
500 Internal Server Error – Consumer matching query does not exist.