﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14481	"better documentation of the default m2m ""through"" class"	Jonathan Morgan	nobody	"It would be polite to document somewhere the exact characteristics of the default m2m ""through"" class. I looked today and could not find that anywhere in the documentation.

Specifically, I think you want something like this in the Model page where it talks about ManyToManyFields:

When you create a ManyToManyField relation without a ""through"" argument, there is still a ""through"" class and table created to hold the association.

The class is:

<model_that_declares_field>.<ManyToManyField_name>.through

This is a model instance for a table with three fields:
- id
- <containing_model>_id
- <other_model>_id

This class can be used to query associated records for a given model instance, and can also be used in static methods (like m2m_changed handlers) to query the association table to pull in instances that are associated either with Model A or Model B so that you can process them.  The through class for a given association is the class that raises the m2m_changed signal, and so it is the class you need to associate an m2m_changed signal handler with, not the Model that contains the association.

It is also dynamically generated when the Model class that declares the ManyToManyField relation is imported, so you can only access ""through"" classes associated with a given pair of models after importing the model that declares the ManyToManyField (and you won't be able to access it if you only import the model that is the ""other"" side of the relation)."	Cleanup/optimization	closed	Documentation	dev	Normal	fixed			Accepted	1	0	0	0	0	0
