Here is an example of models:
class Books(models.Model):
...
class Chapter(models.Model):
...
book = models.ForeignKey('Books')
class Exercise(models.Model):
...
book = models.ForeignKey('Books')
chapter = models.ForeignKey('Chapter')
And here is the Admin class for exercise:
class ExerciseAdmin(admin.ModelAdmin):
...
list_filter = (('book',admin.RelatedOnlyFieldListFilter),('chapter',admin.RelatedOnlyFieldListFilter))
admin.site.register(Exercise, ExerciseAdmin)
I now have the filters book and chapter for exercise. When I click on a book in the filter book, it shows me all the exercises of the selected book accordingly. But in the list of filter chapter, it still shows all the chapters of all the books.
Is there a way to only display, in the filter chapter, the chapters of the book that I selected in the first filter book? How?