Now I use only Q(id=0), and it depends on the DB. Or maybe Q(pk__isnull=True)better? This is useful for concatenating Q objects using an operator |.
Q(id=0)
Q(pk__isnull=True)
|
In fact, there is a special method in Django QuerySet. Model.objects.none()always returns an empty request.
Model.objects.none()
Q(pk__isnull=True)better because it PRIMARY KEYcannot contain values NULL. It is possible that some instance may have id=0.
PRIMARY KEY
NULL
id=0