Skip to content
Advertisement

‘ManyToManyDescriptor’ object has no attribute ‘all’ when accessing related_name

I have 3 models:

JavaScript

and I am trying to access all passengers of a certain Flight when I visit /<int:flight_id> like this:

JavaScript

Your response is appreciated

Thank you In advanced

Advertisement

Answer

You can access passengers of an instance of Flight, not directly from class Flight:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement