Is Queryset.exists () working incorrectly or am I not understanding something?

I donโ€™t understand if this is normal, or is it time to create a new django ticket?

In [17]: User.objects.filter(pk=0)
Out[17]: []

In [18]: User.objects.filter(pk=0).exists()
Out[18]: True

Creature () should return False in this case, I think. This is version 11653 (development version)

I have a related problem with the unique inlineformset validation, and I found that the reason is queryset.exists () is not working correctly

+3
source share
2 answers

This was a bug that was fixed in 11654 changeset

+2
source

You can use User.objects.filter(pk=0).count()to check if there are objects matching your filters.

+2
source

Source: https://habr.com/ru/post/1721009/


All Articles