django filter values with e and operator
from django.db.models import Q
# Assume you have a model named YourModel with a field named your_field
# Step 1: Define the filter criteria
filter_criteria = {
'your_field__icontains': 'e',
}
# Step 2: Build the Q object with OR conditions for each filter criterion
q_objects = Q()
for key, value in filter_criteria.items():
q_objects |= Q({key: value})
# Step 3: Query the database using the filter criteria
filtered_results = YourModel.objects.filter(q_objects)