Fixed ticket #21172

LiveServerThread.join() now behaves like threading.Thread.join().
LiveServerThread.terminate() is instead used to ask live http server to
terminate and close.
Fix python2 breakage caused by e5e044da87800feb6ef63fef1765d8c05022d926.
Improved English in release notes for runserver.

Thanks Tim.
Added more tests and documentation for dictsort.

It's possible to use something like {{ foo|dictsort:'bar.baz' }}
but this wasn't tested or documented.
Fixed a documentation typo introduced by b914991b37.
Fixed #21387 -- Merge two very similar help texts.
Fixed another typo introduced by b914991b3705cb6c91013d962c55cda9deb18d83.

Thanks Claude for catching it.
Fixed typos in documentation.
Distinguish between browser-deprecated locales and internally
deprecated ones.

Thanks to bouke for pointing this out.
Massive migration optimiser improvements + RenameModel opn
Allow squashing of squashed migrations
Added missing info to the release checklist.
flake8 fixes
1.6 isn't under development any more.

Partial forward port of a71ff76 from stable/1.6.x.
Fixed #21376 -- New implementation for query join promotion logic

This commit introduced a new class JoinPromoter that can be used to
abstract away join promotion problems for complex filter conditions.
Query._add_q() and Query.combine() now use the new class.

Also, added a lot of comments about why join promotion is done the way
it is.

Thanks to Tim Graham for original report and testing the changes, and
for Loic Bistuer for review.
Fixed #11320 -- exclude() too aggressive in join promotion
Removed Query.setup_joins() and join() argument outer_if_first.

Instead always create new joins as OUTER.
Removed non-necessary code in Compiler._setup_joins()
Fixed #20600 -- ordered distinct(*fields) in subqueries
Fixed #17001 -- Custom querysets for prefetch_related.

This patch introduces the Prefetch object which allows customizing prefetch
operations.

This enables things like filtering prefetched relations, calling select_related
from a prefetched relation, or prefetching the same relation multiple times
with different querysets.

When a Prefetch instance specifies a to_attr argument, the result is stored
in a list rather than a QuerySet. This has the fortunate consequence of being
significantly faster. The preformance improvement is due to the fact that we
save the costly creation of a QuerySet instance.

Thanks @akaariai for the original patch and @bmispelon and @timgraham
for the reviews.