My code:
class School(models.Model): pass
class Student(models.Model):
school = models.ForeignKey(School)
TYPE_CHOICES = (
('ug', 'Undergraduate'),
('gr', 'Graduate'),
('al', 'Alumnus'),
)
type = models.CharField(max_length=2)
How do I obtain a QuerySet of Schools ordered by the number of Undergraduate Students?