2👍
You would need to import and use Q
object:
from django.db.models import Q
Resulting_Queryset = MyModel.objects.filter(Q(name__istartswith='Nishank Gupta'.strip().lower()) & Q(name__iendswith='Nishank Gupta'.strip().lower()))
This would match Nishank Gupta
and Nishank GUPTA
and NisHANnk Gupta
and so on. Hope this helps. Please do let me know your views.
Or Use iexact:
MyModel.objects.filter(name__iexact='Nishank Gupta'.strip().lower())
- Create a canonical "parent" product in Django Oscar programmatically
- Apache strips down "Authorization" header
- Registered models do not show up in admin
- How can I test if my redis cache is working?
- Accessing django project in LAN systems
Source:stackexchange.com