diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index ca3a620d37..ba9aa88d91 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -5,6 +5,7 @@ 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 admin.site.site_header = "InvenTree Admin" @@ -27,7 +28,11 @@ apipatterns = [ url(r'^manufacturer/', include('supplier.manufacturer_urls')), url(r'^customer/', include('supplier.customer_urls')), url(r'^track/', include('track.urls')), - url(r'^project/', include('project.urls')), + + # Project URLs + url(r'^project/', include(prj_urls)), + url(r'^project-category/', include(prj_cat_urls)), + url(r'^project-part/', include(prj_part_urls)), ] urlpatterns = [ diff --git a/InvenTree/project/urls.py b/InvenTree/project/urls.py index a0f0bc29b6..181f8c3b0d 100644 --- a/InvenTree/project/urls.py +++ b/InvenTree/project/urls.py @@ -2,35 +2,29 @@ from django.conf.urls import url, include from . import views -projectpartpatterns = [ +prj_part_urls = [ # Detail of a single project part url(r'^(?P[0-9]+)/?$', views.ProjectPartDetail.as_view(), name='projectpart-detail'), # List project parts, with optional filters url(r'^\?.*/?$', views.ProjectPartsList.as_view()), - url(r'^$', views.ProjectPartsList.as_view()), + url(r'^$', views.ProjectPartsList.as_view()) ] -projectcategorypatterns = [ +prj_cat_urls = [ # Detail of a single project category url(r'^(?P[0-9]+)/?$', views.ProjectCategoryDetail.as_view(), name='projectcategory-detail'), # List of project categories, with filters url(r'^\?.*/?$', views.ProjectCategoryList.as_view()), - url(r'^$', views.ProjectCategoryList.as_view()), + url(r'^$', views.ProjectCategoryList.as_view()) ] -urlpatterns = [ +prj_urls = [ # Individual project URL url(r'^(?P[0-9]+)/?$', views.ProjectDetail.as_view(), name='project-detail'), # List of all projects url(r'^\?.*/?$', views.ProjectList.as_view()), - url(r'^$', views.ProjectList.as_view()), - - # Project parts - url(r'^parts/', include(projectpartpatterns)), - - # Project categories - url(r'^category/', include(projectcategorypatterns)), + url(r'^$', views.ProjectList.as_view()) ] diff --git a/InvenTree/project/views.py b/InvenTree/project/views.py index 1aeeb5d6b6..2a293a0cca 100644 --- a/InvenTree/project/views.py +++ b/InvenTree/project/views.py @@ -8,7 +8,17 @@ from .serializers import ProjectPartSerializer class ProjectDetail(generics.RetrieveUpdateDestroyAPIView): - """ Project details + """ + + get: + Return a single Project object + + post: + Update a Project + + delete: + Remove a Project + """ queryset = Project.objects.all() @@ -17,7 +27,15 @@ class ProjectDetail(generics.RetrieveUpdateDestroyAPIView): class ProjectList(generics.ListCreateAPIView): - """ List projects + """ + + get: + Return a list of all Project objects + (with optional query filters) + + post: + Create a new Project + """ def get_queryset(self): @@ -36,7 +54,17 @@ class ProjectList(generics.ListCreateAPIView): class ProjectCategoryDetail(generics.RetrieveUpdateAPIView): - """ Project details + """ + + get: + Return a single ProjectCategory object + + post: + Update a ProjectCategory + + delete: + Remove a ProjectCategory + """ queryset = ProjectCategory.objects.all() @@ -45,7 +73,14 @@ class ProjectCategoryDetail(generics.RetrieveUpdateAPIView): class ProjectCategoryList(generics.ListCreateAPIView): - """ List project categories + """ + + get: + Return a list of all ProjectCategory objects + + post: + Create a new ProjectCategory + """ def get_queryset(self): @@ -62,7 +97,14 @@ class ProjectCategoryList(generics.ListCreateAPIView): class ProjectPartsList(generics.ListCreateAPIView): - """ List project parts + """ + + get: + Return a list of all ProjectPart objects + + post: + Create a new ProjectPart + """ serializer_class = ProjectPartSerializer @@ -84,7 +126,17 @@ class ProjectPartsList(generics.ListCreateAPIView): class ProjectPartDetail(generics.RetrieveUpdateDestroyAPIView): - """ Detail for a single project part + """ + + get: + Return a single ProjectPart object + + post: + Update a ProjectPart + + delete: + Remove a ProjectPart + """ queryset = ProjectPart.objects.all()