Skip to content

Commit

Permalink
Merge pull request #383 from LibraryOfCongress/fix-tag-submission
Browse files Browse the repository at this point in the history
Update TagCreate view for named URL pattern
  • Loading branch information
rstorey authored Oct 12, 2018
2 parents b2193e4 + 2f916fa commit 889ad59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions concordia/views_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class TagCreate(generics.ListCreateAPIView):
queryset = Tag.objects.all()

@atomic
def post(self, request, *, pk):
asset = get_object_or_404(Asset, pk=pk)
def post(self, request, *, asset_pk):
asset = get_object_or_404(Asset, pk=asset_pk)

if request.user.username == "anonymous":
raise PermissionDenied()
Expand Down Expand Up @@ -108,7 +108,7 @@ def post(self, request, *, pk):
if tag not in all_submitted_tags:
user_tags.tags.remove(tag)

all_tags_qs = Tag.objects.filter(userassettagcollection__asset__pk=pk)
all_tags_qs = Tag.objects.filter(userassettagcollection__asset__pk=asset_pk)
all_tags = all_tags_qs.values_list("value", flat=True)

return Response({"user_tags": tags, "all_tags": all_tags})

0 comments on commit 889ad59

Please sign in to comment.