Setting up the service URLs
Now that we have all the views in place, it is a good time to start setting up the URLs that the users of our order service can call to fetch and modify orders. Let's go ahead and open the urls.py
file in the main app
directory; first, we need to import all the view classes and functions that we are going to use:
from .views import ( cancel_order, set_next_status, set_status, OrdersByCustomerView, IncompleteOrdersByCustomerView, CompletedOrdersByCustomerView, OrderByStatusView, CreateOrderView, )
Perfect! Now, we can start adding the URLs:
urlpatterns = [ path( r'order/add/', CreateOrderView.as_view() ), path( r'customer/<int:customer_id>/orders/get/', OrdersByCustomerView.as_view() ), path( r'customer/<int:customer_id>/orders/incomplete/get/', IncompleteOrdersByCustomerView.as_view() ), path( r'customer/<int:customer_id>/orders/complete...