mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Updated Supplier URLs and API docs
This commit is contained in:
parent
e8dc592ec7
commit
d75ed57d48
@ -11,7 +11,7 @@ class Company(models.Model):
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
name = models.CharField(max_length=100)
|
||||
name = models.CharField(max_length=100, unique=True)
|
||||
website = models.URLField(blank=True)
|
||||
address = models.CharField(max_length=200,
|
||||
blank=True)
|
||||
|
@ -6,6 +6,8 @@ from rest_framework.documentation import include_docs_urls
|
||||
from part.urls import part_urls, part_cat_urls, part_param_urls, part_param_template_urls
|
||||
from stock.urls import stock_urls, stock_loc_urls
|
||||
from project.urls import prj_urls, prj_part_urls, prj_cat_urls
|
||||
from supplier.urls import cust_urls, manu_urls, supplier_part_urls, price_break_urls, supplier_urls
|
||||
import supplier
|
||||
|
||||
admin.site.site_header = "InvenTree Admin"
|
||||
|
||||
@ -22,11 +24,13 @@ apipatterns = [
|
||||
url(r'^part-param-template/', include(part_param_template_urls)),
|
||||
|
||||
# Supplier URLs
|
||||
url(r'^supplier/', include('supplier.urls')),
|
||||
url(r'^supplier-part/', include('supplier.part_urls')),
|
||||
url(r'^price-break/', include('supplier.price_urls')),
|
||||
url(r'^manufacturer/', include('supplier.manufacturer_urls')),
|
||||
url(r'^customer/', include('supplier.customer_urls')),
|
||||
url(r'^supplier/', include(supplier_urls)),
|
||||
url(r'^supplier-part/', include(supplier_part_urls)),
|
||||
url(r'^price-break/', include(price_break_urls)),
|
||||
url(r'^manufacturer/', include(manu_urls)),
|
||||
url(r'^customer/', include(cust_urls)),
|
||||
|
||||
# Tracking URLs
|
||||
url(r'^track/', include('track.urls')),
|
||||
|
||||
# Project URLs
|
||||
|
@ -1,12 +0,0 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# Customer detail
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.CustomerDetail.as_view(), name='customer-detail'),
|
||||
|
||||
# List customers
|
||||
url(r'^\?.*/?$', views.CustomerList.as_view()),
|
||||
url(r'^$', views.CustomerList.as_view())
|
||||
]
|
@ -1,12 +0,0 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# Manufacturer detail
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.ManufacturerDetail.as_view(), name='manufacturer-detail'),
|
||||
|
||||
# List manufacturers
|
||||
url(r'^\?.*/?$', views.ManufacturerList.as_view()),
|
||||
url(r'^$', views.ManufacturerList.as_view())
|
||||
]
|
@ -1,10 +0,0 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.SupplierPartDetail.as_view(), name='supplierpart-detail'),
|
||||
|
||||
url(r'^\?.*/?$', views.SupplierPartList.as_view()),
|
||||
url(r'^$', views.SupplierPartList.as_view())
|
||||
]
|
@ -1,10 +0,0 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.SupplierPriceBreakDetail.as_view(), name='supplierpricebreak-detail'),
|
||||
|
||||
url(r'^\?.*/?$', views.SupplierPriceBreakList.as_view()),
|
||||
url(r'^$', views.SupplierPriceBreakList.as_view())
|
||||
]
|
@ -2,14 +2,39 @@ from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
pricepatterns = [
|
||||
cust_urls = [
|
||||
# Customer detail
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.CustomerDetail.as_view(), name='customer-detail'),
|
||||
|
||||
# List customers
|
||||
url(r'^\?.*/?$', views.CustomerList.as_view()),
|
||||
url(r'^$', views.CustomerList.as_view())
|
||||
]
|
||||
|
||||
manu_urls = [
|
||||
# Manufacturer detail
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.ManufacturerDetail.as_view(), name='manufacturer-detail'),
|
||||
|
||||
# List manufacturers
|
||||
url(r'^\?.*/?$', views.ManufacturerList.as_view()),
|
||||
url(r'^$', views.ManufacturerList.as_view())
|
||||
]
|
||||
|
||||
supplier_part_urls = [
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.SupplierPartDetail.as_view(), name='supplierpart-detail'),
|
||||
|
||||
url(r'^\?.*/?$', views.SupplierPartList.as_view()),
|
||||
url(r'^$', views.SupplierPartList.as_view())
|
||||
]
|
||||
|
||||
price_break_urls = [
|
||||
url(r'^(?P<pk>[0-9]+)/?$', views.SupplierPriceBreakDetail.as_view(), name='supplierpricebreak-detail'),
|
||||
|
||||
url(r'^\?.*/?$', views.SupplierPriceBreakList.as_view()),
|
||||
url(r'^$', views.SupplierPriceBreakList.as_view())
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
supplier_urls = [
|
||||
|
||||
# Display details of a supplier
|
||||
url(r'^(?P<pk>[0-9]+)/$', views.SupplierDetail.as_view(), name='supplier-detail'),
|
||||
|
@ -13,6 +13,18 @@ from .serializers import CustomerSerializer
|
||||
|
||||
|
||||
class ManufacturerDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a single Manufacturer
|
||||
|
||||
post:
|
||||
Update a Manufacturer
|
||||
|
||||
delete:
|
||||
Remove a Manufacturer
|
||||
|
||||
"""
|
||||
|
||||
queryset = Manufacturer.objects.all()
|
||||
serializer_class = ManufacturerSerializer
|
||||
@ -20,6 +32,15 @@ class ManufacturerDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
|
||||
class ManufacturerList(generics.ListCreateAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a list of all Manufacturers
|
||||
|
||||
post:
|
||||
Create a new Manufacturer
|
||||
|
||||
"""
|
||||
|
||||
queryset = Manufacturer.objects.all()
|
||||
serializer_class = ManufacturerSerializer
|
||||
@ -27,6 +48,18 @@ class ManufacturerList(generics.ListCreateAPIView):
|
||||
|
||||
|
||||
class CustomerDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a single Customer
|
||||
|
||||
post:
|
||||
Update a Customer
|
||||
|
||||
delete:
|
||||
Remove a Customer
|
||||
|
||||
"""
|
||||
|
||||
queryset = Customer.objects.all()
|
||||
serializer_class = CustomerSerializer
|
||||
@ -34,6 +67,15 @@ class CustomerDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
|
||||
class CustomerList(generics.ListCreateAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a list of all Cutstomers
|
||||
|
||||
post:
|
||||
Create a new Customer
|
||||
|
||||
"""
|
||||
|
||||
queryset = Customer.objects.all()
|
||||
serializer_class = CustomerSerializer
|
||||
@ -41,6 +83,18 @@ class CustomerList(generics.ListCreateAPIView):
|
||||
|
||||
|
||||
class SupplierDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a single Supplier
|
||||
|
||||
post:
|
||||
Update a supplier
|
||||
|
||||
delete:
|
||||
Remove a supplier
|
||||
|
||||
"""
|
||||
|
||||
queryset = Supplier.objects.all()
|
||||
serializer_class = SupplierSerializer
|
||||
@ -48,6 +102,15 @@ class SupplierDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
|
||||
|
||||
class SupplierList(generics.ListCreateAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a list of all Suppliers
|
||||
|
||||
post:
|
||||
Create a new Supplier
|
||||
|
||||
"""
|
||||
|
||||
queryset = Supplier.objects.all()
|
||||
serializer_class = SupplierSerializer
|
||||
@ -55,6 +118,18 @@ class SupplierList(generics.ListCreateAPIView):
|
||||
|
||||
|
||||
class SupplierPartDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a single SupplierPart
|
||||
|
||||
post:
|
||||
Update a SupplierPart
|
||||
|
||||
delete:
|
||||
Remove a SupplierPart
|
||||
|
||||
"""
|
||||
|
||||
queryset = SupplierPart.objects.all()
|
||||
serializer_class = SupplierPartSerializer
|
||||
@ -75,6 +150,16 @@ class SupplierPartFilter(FilterSet):
|
||||
|
||||
|
||||
class SupplierPartList(generics.ListCreateAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
List all SupplierParts
|
||||
(with optional query filters)
|
||||
|
||||
post:
|
||||
Create a new SupplierPart
|
||||
|
||||
"""
|
||||
|
||||
queryset = SupplierPart.objects.all()
|
||||
serializer_class = SupplierPartSerializer
|
||||
@ -85,6 +170,18 @@ class SupplierPartList(generics.ListCreateAPIView):
|
||||
|
||||
|
||||
class SupplierPriceBreakDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a single SupplierPriceBreak
|
||||
|
||||
post:
|
||||
Update a SupplierPriceBreak
|
||||
|
||||
delete:
|
||||
Remove a SupplierPriceBreak
|
||||
|
||||
"""
|
||||
|
||||
queryset = SupplierPriceBreak.objects.all()
|
||||
serializer_class = SupplierPriceBreakSerializer
|
||||
@ -101,6 +198,16 @@ class PriceBreakFilter(FilterSet):
|
||||
|
||||
|
||||
class SupplierPriceBreakList(generics.ListCreateAPIView):
|
||||
"""
|
||||
|
||||
get:
|
||||
Return a list of all SupplierPriceBreaks
|
||||
(with optional query filters)
|
||||
|
||||
post:
|
||||
Create a new SupplierPriceBreak
|
||||
|
||||
"""
|
||||
|
||||
queryset = SupplierPriceBreak.objects.all()
|
||||
serializer_class = SupplierPriceBreakSerializer
|
||||
|
Loading…
Reference in New Issue
Block a user