[Fixed]-2 or more foreign key levels for Django Queryset

1👍

You just have to use the double underscore notation like so:

loans = Loan.objects.filter(id=current_loan)
    .prefetch_related('consists_of_book', 'consists_of_book__written_by_author')
👤Tim

Leave a comment