I'm getting the boolean value from a queryset like this:
activo = Carros.objects.all().values_list('is_active', flat=True).filter(nombre='carro')
then my if statement is this:
if activo == True:
raise forms.ValidationError('El Auto está activo')
even though the variable 'activo' gets a True value it does not return the ValidationError.
What I did was to set a variable
a = True
and then add it in the if statement
if activo == True:
raise forms.ValidationError('El Auto está activo')
And it works.
In the Python shell whenver I excute the query I see the result lik this
<QuerySet [True]>
I'm not sure what is the problem.
the 'is_active' field in the model:
is_active = models.BooleanField(blank=False, null=False, default=True)
Note: DB is Postgresql