InvenTree/InvenTree/part/views.py
Oliver Walters 7ce5a9a7e5 Papa Pep
2017-03-28 23:38:12 +11:00

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