mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
36 lines
843 B
Python
36 lines
843 B
Python
from django.shortcuts import render, get_object_or_404
|
|
from django.http import HttpResponse, Http404
|
|
|
|
from rest_framework import generics
|
|
|
|
from .models import PartCategory, Part
|
|
from .serializers import PartSerializer, PartCategorySerializer
|
|
|
|
|
|
def index(request):
|
|
return HttpResponse("Hello world. This is the parts page")
|
|
|
|
|
|
class PartDetail(generics.RetrieveAPIView):
|
|
|
|
queryset = Part.objects.all()
|
|
serializer_class = PartSerializer
|
|
|
|
|
|
class PartList(generics.ListAPIView):
|
|
|
|
queryset = Part.objects.all()
|
|
serializer_class = PartSerializer
|
|
|
|
|
|
class PartCategoryDetail(generics.RetrieveAPIView):
|
|
|
|
queryset = PartCategory.objects.all()
|
|
serializer_class = PartCategorySerializer
|
|
|
|
|
|
class PartCategoryList(generics.ListAPIView):
|
|
|
|
queryset = PartCategory.objects.all()
|
|
serializer_class = PartCategorySerializer
|