I have something like this in my models.py
:
class Section(models.Model):
title = models.CharField(max_length=50)
class Lesson1(models.Model):
section = models.ForeignKey(Section)
title = models.CharField(max_length=50)
...
sort_index = models.IntegerField()
class Lesson2(models.Model):
section = models.ForeignKey(Section)
title = models.CharField(max_length=50)
....
sort_index = models.IntegerField()
And I need to display them mixed, like this:
section title:
-lesson1 title
-lesson2 title
-lesson1 title
next section title:
-lesson2 title
-lesson2 title
-lesson1 title
Is there a nice way to do this?