[1.7.x] Fix broken test
[1.7.x] Fix __latest__ to actually resolve to the latest migration
[1.7.x] Fixed #22861: Internal migrations done first so __first__ works

Thanks to Chris Beaven.
[1.7.x] Fixed several flake8 errors

Backport of d015c9d11c from master
[1.7.x] Fixed #14481 -- Documented implicit "through" class created by ManyToManyField.

Thanks to jonathanmorgan for the report and initial patch.

Backport of de90129070 from master
[1.7.x] Fixed #22859 -- Improved crossDomain technique in CSRF example.

Thanks flisky for the report.

Backport of 0be4d64487 from master