my filters.py file
import django_filters
from django_filters import CharFilter
from .models import *
from django.forms.widgets import TextInput, Textarea
from django.forms import widgets
class ProductFilter(django_filters.FilterSet):
name=CharFilter(field_name='name', lookup_expr='icontains', label="", widget=TextInput(attrs={'placeholder': 'Search Here'}))
class Meta:
model=Product
fields='__all__'
exclude=['name', 'price', 'digital', 'image', 'description']
How can I change width of the filter form to the size of search bar we have in stackoverflow for example?
A code snippet demonstrating it would be very helpful.
This code worked.
from django import forms
class ProductFilter(django_filters.FilterSet):
name=CharFilter(field_name='name', lookup_expr='icontains', label="", widget=TextInput(attrs=
{ 'placeholder': 'Search for products, brands and more',
'class': 'form-control',
'size': 100,
}
))