I have not confirmed that this is the reason, but the Comment model has a default order, which affects the distinct() method:
In [1]: print Comment.objects.values('ip_address').distinct().query SELECT DISTINCT "django_comments"."ip_address", "django_comments"."submit_date" FROM "django_comments" ORDER BY "django_comments"."submit_date" ASC
This is a documentary function .
Now, how can it be that two comments have exactly the same timestamp? I suppose you are using MySQL which does not support anything less than a second.
And if you want to get rid of the default order, just do:
Comment.objects.order_by().values('ip_address').distinct()
source share