开发者

What does 'name__iexact' mean in django model filters?

开发者 https://www.devze.com 2022-12-25 11:56 出处:网络
name_iexact keyword is a parameter we can pass to filter function in django.model. Can someone please help me understand what it does?

name_iexact keyword is a parameter we can pass to filter function in django.model. Can someone please help me understand what it does?

Map.objects.filter(name__iexac开发者_开发百科t=self.cleaned_data["name"]).count()


It's a case insensitive match. It will retrive database records with "name" field matching self.cleaned_data["name"], while the case doesn't necessarily have to match.

You can construct those lookups appending __iexact to any field name. See the documentation for more on iexact or for list of other similar field lookups.


I suspect you are using Django or some kind of ORM.

name__iexact means that you are doing a case insensitive match on the field name

check for instance http://docs.djangoproject.com/en/dev/topics/db/queries/ for more documentation on django queries.

I hope this will help you, Jerome Wagner

0

精彩评论

暂无评论...
验证码 换一张
取 消