Based on the article Related ManyToManyField in Django admin site, the file forms.py
contains a summary of the recommended code.
The file manytomany.py
contains a generic base class in order to be DRY and avoid repeating the same code in many form classes.
An example of how to use can be found in the NineCMS project commit 52c710f.