added exclude template tag
fixed flake8 issues