Reduce number of evaluated queries.

* Replace "foo.count() == 0" with "not foo.exists()" in python files
* Replace "foo.count() > 0" with "foo.exists()" in python files
* Replace "{% if foo.count %}{% for bar in foo %}" with
  "{% if foo %}{% for bar in foo %}"
* Use 'with' template tag in templates
* Add myself to AUTHORS list
Reduce number of evaluated queries.

* Properly close with tag.
* Properly check for band existance
Reduce number of evaluated queries.

Use 'for..empty' templatetag
Don't use |length filter if not reqired
Merge pull request #1056 from piotrjakimiak/reduce_sql_queries

Reduce query count