I have the following django model:
class Category(models.Model):
name = models.CharField(maxlength=20)
parent = models.ForeignKey('self', null=True)
Note that the field parent
is self referencing i.e. a category can have a parent.
How can I find all Category
objects that have no child categories?