Reputation: 33
In my filters.py I have a filter:
class myFilter(django_filters.FilterSet):
class Meta:
model= bdMuebles
fields = ["Type","Code","Name"]
and in views.py I have:
def vwMuebles(request):
vrMuebles=bdMuebles.objects.all()
vrFiltroMbl=myFilter(request.GET,queryset=vrMuebles)
vrMuebles=vrFiltroMbl.qs
return render(request,"MyApp/Muebles.html",{
"dtMuebles":vrMuebles,
"dtFiltroMbl": vrFiltroMbl,
})
My question is: How can myfilter search for partial matches with case insensitive, ie, if type app it gives
Upvotes: 0
Views: 612
Reputation: 33
Found the solution, changing myfilter fix it
class ftMuebles(django_filters.FilterSet):
Type= django_filters.CharFilter(lookup_expr='contains')
Code= django_filters.CharFilter(lookup_expr='contains')
Name= django_filters.CharFilter(lookup_expr='contains')
class Meta:
model= bdMuebles
fields = ["Type", "Code", "Name"]
Upvotes: 1