﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30435	__iexact not working inside validator function.	Diego Arturo Hernandez Fuentes	nobody	"I have my query into validation to find if exist a duplicate name in my model


{{{
    def validate_name(self, value):
        if not value:
            raise serializers.ValidationError('Proporciona un valor, por favor.')
        
        try:
            exist_name = FundingSource.objects.filter(name__iexact=value)                       # here is the error __icontains is NOT WORKING
            if len(exist_name) > 0:
                raise serializers.ValidationError('Este nombre ya fue usado, por favor proporciona otro valor.')  # I need display this message in my console to be sure that exists a duplicate
        except Exception as e:
            pass
        else:
            return value
}}}

I have in my model

Funding 1
Funding 2
Funding 3
Funding 4

Next, I tried to type `funding 1` to disallow me to create that name, but, the queryset display me 

<QuerySet []>

Then, create new one item in my table.

Funding 1
Funding 2
Funding 3
Funding 4
funding 1

So this is wrong, your __iexact is bad,

so I need that Django developer team resolve this, now.

It's urgent, please. What is the best way to develop __iexact or __icontains.

Thanks


My django version is 2.1.5
Django rest framework version = 3.9.0"	Bug	closed	Database layer (models, ORM)	dev	Normal	worksforme			Unreviewed	0	0	0	0	0	0
