Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
.env
.env
.claude
3 changes: 3 additions & 0 deletions backend/inventory/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class PublicCollectionItemSerializer(serializers.ModelSerializer):

current_location = LocationSerializer(read_only=True)
location_name = serializers.SerializerMethodField()
box_code = serializers.CharField(source="box.box_code", read_only=True)

Comment thread
Edwz208 marked this conversation as resolved.
class Meta:
model = CollectionItem
Expand All @@ -140,6 +141,7 @@ class Meta:
"is_on_floor",
"current_location",
"location_name",
"box_code",
"created_at",
"updated_at",
]
Expand All @@ -153,6 +155,7 @@ class Meta:
"working_condition",
"status",
"is_on_floor",
"box_code",
"current_location",
"location_name",
"created_at",
Expand Down
5 changes: 2 additions & 3 deletions backend/inventory/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ class CollectionItemViewSet(viewsets.ModelViewSet):
queryset = CollectionItem.objects.all().select_related("box", "current_location")

def get_serializer_class(self):
if self.action in ["create", "update", "partial_update"]:
return AdminCollectionItemSerializer
return CollectionItemSerializer
return AdminCollectionItemSerializer

def get_permissions(self):
# Match the Admin view: only Admins should be able to trigger 'destroy'
Expand Down Expand Up @@ -172,6 +170,7 @@ class AdminCollectionItemViewSet(viewsets.ModelViewSet):
Supports POST, PUT, PATCH, DELETE.
Only accessible to users with ADMIN or Volunteers role depending on operation with
destory being Admin Only
NOT USED CURRENTLY
"""

queryset = CollectionItem.objects.all().select_related("current_location")
Expand Down
Loading
Loading