Skip to content

Commit

Permalink
Merge pull request #36 from uclouvain/0.4
Browse files Browse the repository at this point in the history
fix qs tags filter
  • Loading branch information
mathieuzen authored Apr 12, 2024
2 parents 7726d49 + 8ed0300 commit 3550144
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions osis_history/contrib/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from .serializers import HistoryEntryListSerializer
from osis_history.models import HistoryEntry

from django.db.models import Q

__all__ = [
"HistoryEntryListAPIMixin",
]
Expand All @@ -18,7 +20,8 @@ def get_queryset(self):
"""Filter the queryset with the object's uuid passed in url"""
qs = HistoryEntry.objects.filter(object_uuid=self.kwargs["uuid"])
tags = self.request.query_params.get('tags', '')
if tags:
qs = qs.filter(tags__contained_by=tags.split(','))
return qs

queries = [Q(tags__contains=[tag]) for tag in tags.split(',')]
for query in queries:
qs |= qs.filter(query)
return qs
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osis-history",
"version": "0.1.0",
"version": "0.4.0",
"private": true,
"scripts": {
"build": "vite build --outDir osis_history/static/osis_history --mode production --sourcemap true",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

setup(
name='OSIS History',
version='0.3',
version='0.4',
description='History management API and UI',
url='http://github.com/uclouvain/osis-history',
author='Université catholique de Louvain',
Expand Down

0 comments on commit 3550144

Please sign in to comment.