Skip to content

Commit

Permalink
TagViewSet should use PassUserMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed Mar 9, 2023
1 parent f100198 commit 2fe7f8b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/documents/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,14 @@ class CorrespondentViewSet(ModelViewSet, PassUserMixin):
)


class TagViewSet(ModelViewSet):
class TagViewSet(ModelViewSet, PassUserMixin):
model = Tag

queryset = Tag.objects.annotate(document_count=Count("documents")).order_by(
Lower("name"),
)

def get_serializer_class(self, *args, **kwargs):
# from UserPassMixin
kwargs.setdefault("user", self.request.user)
if int(self.request.version) == 1:
return TagSerializerVersion1
else:
Expand Down

0 comments on commit 2fe7f8b

Please sign in to comment.