InvManage.views.consumer_views

Module Contents

Functions

create_consumer_view(request)

Creates a consumer on POST request, and returns a consumer creation form on GET request.

update_consumer_view(request)

Updates a consuemr on POST request and returns the consumer update form for GET request.

delete_consumer_view(request, pk)

Deletes the consumer with primary key pk on POST request.

display_consumers_view(request)

Retrieves the list of consumers on GET request.

get_consumer(request)

Returns the JSON serialized data of the requested consumer on GET request.

InvManage.views.consumer_views.create_consumer_view(request)

Creates a consumer on POST request, and returns a consumer creation form on GET 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
Request Headers
  • 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

Status Codes
  • 200 OK – Consumer creation form received successfully.

POST /consumer

Creates a consumer.

Example request:

POST /consumer/ HTTP/1.1
Host: localhost:8000
Content-Type: multipart/form-data;
Form Parameters
  • consumer-nameThe Music Store

  • consumer-identifierCONS1256

  • consumer-gstin89ACC654654335

  • consumer-phone+91 6543525422

  • consumer-addressPlot no. 958, N-4, Neo Complex, Barh, Wokha, Nagaland, 797111

  • consumer-emailjohnDoe@themusic.store

  • consumer-locationWokha

Response Headers
  • Content-Type – multipart/form-data; boundary=—-WebKitFormBoundaryLTR88aZAnBUSE7mv

Status Codes
InvManage.views.consumer_views.update_consumer_view(request)

Updates a consuemr on POST request and returns the consumer update form for GET 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
Request Headers
  • 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

Status Codes
  • 200 OK – Consumer update form received successfully.

POST /consumer/update

Updates the consumer.

Example request:

POST /company/update HTTP/1.1
Host: localhost:8000
Content-Type: multipart/form-data;
Form Parameters
  • pk7

  • consumer-nameThe Music Store

  • consumer-identifierCONS1256

  • consumer-gstin89ACC654654335

  • consumer-phone+91 6543525422

  • consumer-addressPlot no. 958, N-4, Neo Complex, Barh, Wokha, Nagaland, 797111

  • consumer-emailjohnDoe@themusic.store

  • consumer-locationWokha

Response Headers
  • Content-Type – multipart/form-data; boundary=—-WebKitFormBoundaryLTR88aZAnBUSE7mv

Status Codes
InvManage.views.consumer_views.delete_consumer_view(request, pk)

Deletes the consumer with primary key pk on POST 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
Status Codes
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
Request Headers
  • 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

Status Codes
  • 200 OK – List of consumers received successfully.

InvManage.views.consumer_views.get_consumer(request)

Returns the JSON serialized data of the requested consumer on GET 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
Status Codes