where we have to use ‘through’ in django many-to-many model field?
In django the many-to-many field used to have multiple relationships with referred and used models
In generally, if you use many-to-many field django automatically creates a intermediate table
suppose, for your mighty usecase, you want to add some additional fields in that intermediate table
you can go proceed with the ‘through‘ feature
refer-doc link https://docs.djangoproject.com/en/dev/topics/db/models/#intermediary-manytomany
In the above attached image, the Membership class contains the additional fields like date_joined,invite_reason available as I explained above
Without using this special feature, if you do the adding extra fields(date_joined,invite_reason) in the Group class itself,
you can have the field for the each group object like
group([person1,person2,person3,etc..],date_joined,invite_reason)
but not like this
group([person1,date_joined,invite_reason],[person2,date_joined,invite_reason],
[person3,date_joined,invite_reason]…
etc…)
To obtain this usecase we have to go with ‘through‘ attribute feature as availble in the diagram




