Update the custom models tests mixin to support Django 1.6, 1.8+.

Review Request #8682 — Created Jan. 30, 2017 and submitted — Latest diff uploaded

Information

Djblets
release-0.10.x
8b642f7...

Reviewers

Our TestModelsLoaderMixin, while working fine on Django 1.6, had some
problems on modern versions of Django. Models weren't gaining their
correct app labels and were appearing in two apps at once. We also were
attempting to register models that were imported from other modules
(like User, Site, etc.). Along with this, not all state was properly
cleared.

This change fixes the mixin for Django 1.8 and higher. This gives us
compatibility with Django 1.6 and 1.8 through 1.10. It does not support
Django 1.7 (which Djblets will not officially support anyway), due to
issues in Django 1.7 that were fixed in 1.8 involving ManyToManyFields
not being properly created in the database under these conditions.

Unit tests pass on 1.6, 1.8, 1.9, 1.10.