Small test_ajax.py refactorings

- Renamed models to tnc_models and new_models to swid_models
- Reordered fixtures
- Added section comments
Refactored out ajax_request function

- There is now a helper function to do an AJAX request.
Added test for `tags_for_session` ajax endpoint
Refactored tags_for_session
Moved get_installed_tags_with_time to tag model

As that function returns tag instances, it's probably better to bundle
it with the Tag model.

See also: https://redbeacon.github.io/2014/01/28/Fat-Models-a-Django-Code-Organization-Strategy/
Refactored get_installed_tags_with_time

Among other things, this does a database prefetch optimization in
get_installed_tags_with_time

Originally, the function first did two SQL queries to fetch the device
associated with the current session and the sessions associated with
that device, and then created a new query for each session up until
today (to fetch the related tags). This caused a complexity of `O(n +
2)`, where n is the number of sessions <= today.

By using the `prefetch_related('tag_set')` method, the ORM first does a
single query where all related tags are queried. The result is then
joined in Python, reducing the complexity to `O(3)`.

Things like these can be debugged easily when the `django_extensions`
package is installed:

    python manage.py shell_plus --print-sql