Skip to content

Commit

Permalink
add changelog
Browse files Browse the repository at this point in the history
Issue: AAH-2761
  • Loading branch information
jerabekjiri committed Oct 11, 2023
1 parent 4d6baae commit 2a33fb8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGES/2761.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add _ui/v1/tags/collections and _ui/v1/tags/roles endpoints.
Add sorting by name and count, and enable filtering by name (exact, partial and startswith match).
23 changes: 5 additions & 18 deletions galaxy_ng/app/api/ui/viewsets/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,25 @@ class CollectionsTagsViewSet(
queryset = Tag.objects.all()


class RolesTagFilter(filterset.FilterSet):
sort = filters.OrderingFilter(
fields=(
("name", "name"),
('count', 'count')
),
)

class Meta:
model = LegacyRole
fields = {
"name": ["exact", "icontains", "contains", "startswith"],
}


class RolesTagsViewSet(api_base.GenericViewSet):
"""
ViewSet for roles' tags within the system.
"""
queryset = LegacyRole.objects.all()
permission_classes = [access_policy.TagsAccessPolicy]
versioning_class = versioning.UIVersioning
serializer_class = TagSerializer
filter_backends = (DjangoFilterBackend,)
filterset_class = RolesTagFilter

ordering_fields = ["name", "count"]
ordering = ["name"]
filter_fields = ["exact", "icontains", "contains", "startswith"]

def _filter_queryset(self, queryset, request):
"""Custom sorting and filtering."""
"""
Custom sorting and filtering,
must be performed manually since
we are overwriting the queryset with a list of tags.
"""

query_params = request.query_params.copy()
sort = query_params.get("sort")
Expand Down

0 comments on commit 2a33fb8

Please sign in to comment.