You're right. `groups` is a QuerySet object, therefore `length` can work but it's better to use `groups.count()` instead of length.