Reputation: 678
I'm using Django 2.0.7.
I want to get all the fields of a model. I can get all the normal fields in:
model._meta.fields
And I can get m2m fields in:
model._meta.local_many_to_many
However, if the m2m field has an through table, I can't access them? How can I achieve this?
Upvotes: 1
Views: 1233
Reputation: 5740
The m2m fields have a through
model that you can access:
YourModel.m2m_field.through._meta.fields
Upvotes: 1