Skip to content

Commit

Permalink
chore: fetch content from multiple categories
Browse files Browse the repository at this point in the history
Signed-off-by: Kathurima Kimathi <kathurimakimathi415@gmail.com>
  • Loading branch information
KathurimaKimathi committed Nov 29, 2023
1 parent 2e6cf56 commit db3ca29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mycarehub/content/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def filter_queryset(self, request, queryset, view):
categories = category_name.split(",")
queryset = queryset.filter(categories__name__in=categories)
if category_id and queryset.model is ContentItem:
queryset = queryset.filter(Q(categories__id=category_id))
category_ids = category_id.split(",")
queryset = queryset.filter(Q(categories__id__in=category_ids))
if exclude_categories and queryset.model is ContentItem:
queryset = queryset.exclude(categories__name__in=exclude_categories)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Generated by Django 4.2.6 on 2023-10-31 17:38

from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.images.models
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down

0 comments on commit db3ca29

Please sign in to comment.