You can use isnull with related_query_name :
class Category(models.Model):
Here I would recommend specifying at least a meaningful related_name ! If you specify only related_name , then related_query_name will be assigned this name by default (here: children ). If you do not specify either of the two, the default rqn value matches the model name: category , not category_set
Category.objects.filter(category__isnull=True)
source share