summaryrefslogtreecommitdiff
path: root/procurement/urls.py
diff options
context:
space:
mode:
authorKyle McFarland <tfkyle@gmail.com>2018-10-21 19:26:32 -0600
committerKyle McFarland <tfkyle@gmail.com>2018-10-21 19:26:32 -0600
commit377985be10cb959fa975e9cddc5161d346f3d2c6 (patch)
tree8caf1ea9b50e487657930ca0fda71fd8920af8ec /procurement/urls.py
parent02ede72ce9ddeb4d7d7241503585bb07fe3e2c50 (diff)
downloadcoding-assignment-377985be10cb959fa975e9cddc5161d346f3d2c6.zip
coding-assignment-377985be10cb959fa975e9cddc5161d346f3d2c6.tar.gz
coding-assignment-377985be10cb959fa975e9cddc5161d346f3d2c6.tar.bz2
Add view suppliers view and suppliers API endpoint
This adds a simple view (mostly cribbed from the component view but without the database stats) to view details for a given supplier, currently lists the components they supply and name/email address pairs for representatives however there's room to add fields for other representative contact and company information as well. On the API side this adds 3 endpoints: * api/suppliers: returns a list of all suppliers and their representatives * api/suppliers/<id>: returns a supplier object containing the representatives for the given supplier * api/suppliers/<id>/components: returns a supplier object containing a list of components supplied by the given supplier This also contains minor documentation and base template changes, fixing the navigation menu to use class="active" on the currently selected page (previously didn't work due to page_name capitalization)
Diffstat (limited to 'procurement/urls.py')
-rw-r--r--procurement/urls.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/procurement/urls.py b/procurement/urls.py
index d629635..be721ae 100644
--- a/procurement/urls.py
+++ b/procurement/urls.py
@@ -1,12 +1,16 @@
from django.urls import path
-from procurement.views import ComponentSearchView, DocumentationView
-from procurement.api import ComponentAPIList, ComponentAPIRetrieve
+from procurement.views import ComponentSearchView, SupplierSearchView, DocumentationView
+from procurement.api import ComponentAPIList, ComponentAPIRetrieve, SupplierAPIList, SupplierAPIRetrieve, SupplierAPIComponents
urlpatterns = [
path('', ComponentSearchView.as_view(), name='component-search'),
+ path('suppliers', SupplierSearchView.as_view(), name='supplier-search'),
path('documentation', DocumentationView.as_view(), name='documentation'),
# API Urls
path('api/components/', ComponentAPIList.as_view(), name='api-component-list'),
path('api/components/<int:pk>/', ComponentAPIRetrieve.as_view(), name='api-component-retrieve'),
+ path('api/suppliers/', SupplierAPIList.as_view(), name='api-supplier-list'),
+ path('api/suppliers/<int:pk>/', SupplierAPIRetrieve.as_view(), name='api-supplier-retrieve'),
+ path('api/suppliers/<int:pk>/components', SupplierAPIComponents.as_view(), name='api-supplier-components'),
]