1👍
✅
It is possible that both the category and the tag match, and thus act as a "multiplier" for each other. You can work with .distinct()
[Django-doc] to retrieve unique items:
if search:
wallpapers = Wallpaper.objects.filter(
Q(name__icontains=search) | Q(category__category_name__icontains=search) | Q(tags__tag__icontains=search)
).distinct()
Source:stackexchange.com