mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-23 11:55:54 +00:00
Updated API URLs
This commit is contained in:
@@ -4,32 +4,38 @@ from django.http import HttpResponse, Http404
|
||||
from rest_framework import generics
|
||||
|
||||
from .models import PartCategory, Part
|
||||
from .serializers import PartSerializer, PartCategorySerializer
|
||||
from .serializers import PartBriefSerializer, PartDetailSerializer
|
||||
from .serializers import PartCategoryBriefSerializer, PartCategoryDetailSerializer
|
||||
|
||||
|
||||
def index(request):
|
||||
def part_index(request):
|
||||
return HttpResponse("Hello world. This is the parts page")
|
||||
|
||||
def category_index(request):
|
||||
return HttpResponse("This is the category page")
|
||||
|
||||
class PartDetail(generics.RetrieveAPIView):
|
||||
|
||||
queryset = Part.objects.all()
|
||||
serializer_class = PartSerializer
|
||||
serializer_class = PartDetailSerializer
|
||||
|
||||
|
||||
class PartList(generics.ListAPIView):
|
||||
|
||||
queryset = Part.objects.all()
|
||||
serializer_class = PartSerializer
|
||||
serializer_class = PartBriefSerializer
|
||||
|
||||
|
||||
class PartCategoryDetail(generics.RetrieveAPIView):
|
||||
|
||||
""" Return information on a single PartCategory
|
||||
"""
|
||||
queryset = PartCategory.objects.all()
|
||||
serializer_class = PartCategorySerializer
|
||||
serializer_class = PartCategoryDetailSerializer
|
||||
|
||||
|
||||
class PartCategoryList(generics.ListAPIView):
|
||||
|
||||
queryset = PartCategory.objects.all()
|
||||
serializer_class = PartCategorySerializer
|
||||
""" Return a list of all top-level part categories.
|
||||
Categories are considered "top-level" if they do not have a parent
|
||||
"""
|
||||
queryset = PartCategory.objects.filter(parent=None)
|
||||
serializer_class = PartCategoryBriefSerializer
|
||||
|
Reference in New Issue
Block a user