Reduce the number of database queries done by the Submission.get_flags method in the demos app.

Do some PEP8 work while I’m here.
Fixed a few import errors.
Merge pull request #1875 from jezdez/taggit-homepage-queries

Reduce the number of database queries done by the Submission.get_flags method in the demos app.