This commit is contained in:
parent
cb7332f4e9
commit
fa6ac5334e
1 changed files with 5 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.db.models import Q
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from servala.core.models import (
|
from servala.core.models import (
|
||||||
|
@ -25,6 +26,10 @@ class ServiceFilterForm(forms.Form):
|
||||||
queryset = queryset.filter(category=category)
|
queryset = queryset.filter(category=category)
|
||||||
if cloud_provider := self.cleaned_data.get("cloud_provider"):
|
if cloud_provider := self.cleaned_data.get("cloud_provider"):
|
||||||
queryset = queryset.filter(offerings__provider=cloud_provider)
|
queryset = queryset.filter(offerings__provider=cloud_provider)
|
||||||
|
if search := self.cleaned_data.get("q"):
|
||||||
|
queryset = queryset.filter(
|
||||||
|
Q(name__icontains=search) | Q(category__name__icontains=search)
|
||||||
|
)
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue