Add detail view for Build model

This commit is contained in:
Oliver Walters 2019-05-23 21:36:54 +10:00
parent 8f3fe94ff4
commit a6f95c70aa

View File

@ -40,6 +40,17 @@ class BuildList(generics.ListCreateAPIView):
]
class BuildDetail(generics.RetrieveUpdateAPIView):
""" API endpoint for detail view of a Build object """
queryset = Build.objects.all()
serializer_class = BuildSerializer
permission_classes = [
permissions.IsAuthenticatedOrReadOnly,
]
class BuildItemList(generics.ListCreateAPIView):
""" API endpoint for accessing a list of BuildItem objects
@ -85,5 +96,7 @@ build_item_api_urls = [
build_api_urls = [
url(r'^item/?', include(build_item_api_urls)),
url(r'^(?P<pk>\d+)/', BuildDetail.as_view(), name='api-build-detail'),
url(r'^.*$', BuildList.as_view(), name='api-build-list'),
]