mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge remote-tracking branch 'inventree/master'
This commit is contained in:
commit
413e996e92
@ -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):
|
class BuildItemList(generics.ListCreateAPIView):
|
||||||
""" API endpoint for accessing a list of BuildItem objects
|
""" API endpoint for accessing a list of BuildItem objects
|
||||||
|
|
||||||
@ -85,5 +96,7 @@ build_item_api_urls = [
|
|||||||
build_api_urls = [
|
build_api_urls = [
|
||||||
url(r'^item/?', include(build_item_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'),
|
url(r'^.*$', BuildList.as_view(), name='api-build-list'),
|
||||||
]
|
]
|
||||||
|
@ -379,7 +379,7 @@ class Part(models.Model):
|
|||||||
|
|
||||||
total -= self.allocation_count
|
total -= self.allocation_count
|
||||||
|
|
||||||
return total
|
return max(total, 0)
|
||||||
|
|
||||||
def isStarredBy(self, user):
|
def isStarredBy(self, user):
|
||||||
""" Return True if this part has been starred by a particular user """
|
""" Return True if this part has been starred by a particular user """
|
||||||
|
@ -50,6 +50,7 @@ class PartBriefSerializer(serializers.ModelSerializer):
|
|||||||
'url',
|
'url',
|
||||||
'full_name',
|
'full_name',
|
||||||
'description',
|
'description',
|
||||||
|
'total_stock',
|
||||||
'available_stock',
|
'available_stock',
|
||||||
'image_url',
|
'image_url',
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user