We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Templates language is taken into account in the main view
I'm testing Pootle 2.8.0RC3 and I've found an issue related to #4568.

When I filter the translations for a single project, the progress bar now shows 100% (the templates aren't taken into account now, great):
![image](https://cloud.githubusercontent.com/assets/104028/22153800/1b63c99e-df29-11e6-903a-f944c4375213.png)

However, when I go back to the global view, that project shows a progress bar including the templates result:
![image](https://cloud.githubusercontent.com/assets/104028/22153805/21d6f4c2-df29-11e6-9134-2e39ce3583c7.png)

Thank you!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pootle/apps/pootle_data/project_data.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) Pootle contributors.
4 #
5 # This file is a part of the Pootle project. It is distributed under the GPL3
6 # or later license. See the LICENSE file for a copy of the license and the
7 # AUTHORS file for copyright and authorship information.
8 
9 from pootle.core.delegate import revision
10 
11 from .utils import RelatedStoresDataTool, RelatedTPsDataTool
12 
13 
14 class ProjectDataTool(RelatedTPsDataTool):
15     """Retrieves aggregate stats for a Project"""
16 
17     cache_key_name = "project"
18 
19     def filter_data(self, qs):
20         return qs.filter(tp__project=self.context)
21 
22     @property
23     def rev_cache_key(self):
24         return revision.get(
25             self.context.__class__)(self.context.directory).get(key="stats")
26 
27 
28 class ProjectResourceDataTool(RelatedStoresDataTool):
29     group_by = ("store__translation_project__language__code", )
30     cache_key_name = "project_resource"
31 
32     @property
33     def project_path(self):
34         return (
35             "/%s%s"
36             % (self.project_code, self.tp_path))
37 
38     @property
39     def tp_path(self):
40         return (
41             "/%s%s"
42             % (self.dir_path,
43                self.filename))
44 
45     def filter_data(self, qs):
46         return (
47             qs.filter(store__translation_project__project__code=self.project_code)
48               .filter(store__tp_path__startswith=self.tp_path))
49 
50     @property
51     def context_name(self):
52         return "/projects%s" % self.project_path
53 
54 
55 class ProjectSetDataTool(RelatedTPsDataTool):
56     group_by = ("tp__project__code", )
57     cache_key_name = "projects"
58 
59     def get_root_child_path(self, child):
60         return child[self.group_by[0]]
61 
62     @property
63     def context_name(self):
64         return "ALL"
65
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pootle/apps/pootle_data/project_data.py b/pootle/apps/pootle_data/project_data.py
--- a/pootle/apps/pootle_data/project_data.py
+++ b/pootle/apps/pootle_data/project_data.py
@@ -62,3 +62,7 @@
     @property
     def context_name(self):
         return "ALL"
+
+    def filter_data(self, qs):
+        qs = super(ProjectSetDataTool, self).filter_data(qs)
+        return qs.exclude(tp__language__code="templates")

{"golden_diff": "diff --git a/pootle/apps/pootle_data/project_data.py b/pootle/apps/pootle_data/project_data.py\n--- a/pootle/apps/pootle_data/project_data.py\n+++ b/pootle/apps/pootle_data/project_data.py\n@@ -62,3 +62,7 @@\n     @property\n     def context_name(self):\n         return \"ALL\"\n+\n+    def filter_data(self, qs):\n+        qs = super(ProjectSetDataTool, self).filter_data(qs)\n+        return qs.exclude(tp__language__code=\"templates\")\n", "issue": "Templates language is taken into account in the main view\nI'm testing Pootle 2.8.0RC3 and I've found an issue related to #4568.\r\n\r\nWhen I filter the translations for a single project, the progress bar now shows 100% (the templates aren't taken into account now, great):\r\n![image](https://cloud.githubusercontent.com/assets/104028/22153800/1b63c99e-df29-11e6-903a-f944c4375213.png)\r\n\r\nHowever, when I go back to the global view, that project shows a progress bar including the templates result:\r\n![image](https://cloud.githubusercontent.com/assets/104028/22153805/21d6f4c2-df29-11e6-9134-2e39ce3583c7.png)\r\n\r\nThank you!\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom pootle.core.delegate import revision\n\nfrom .utils import RelatedStoresDataTool, RelatedTPsDataTool\n\n\nclass ProjectDataTool(RelatedTPsDataTool):\n    \"\"\"Retrieves aggregate stats for a Project\"\"\"\n\n    cache_key_name = \"project\"\n\n    def filter_data(self, qs):\n        return qs.filter(tp__project=self.context)\n\n    @property\n    def rev_cache_key(self):\n        return revision.get(\n            self.context.__class__)(self.context.directory).get(key=\"stats\")\n\n\nclass ProjectResourceDataTool(RelatedStoresDataTool):\n    group_by = (\"store__translation_project__language__code\", )\n    cache_key_name = \"project_resource\"\n\n    @property\n    def project_path(self):\n        return (\n            \"/%s%s\"\n            % (self.project_code, self.tp_path))\n\n    @property\n    def tp_path(self):\n        return (\n            \"/%s%s\"\n            % (self.dir_path,\n               self.filename))\n\n    def filter_data(self, qs):\n        return (\n            qs.filter(store__translation_project__project__code=self.project_code)\n              .filter(store__tp_path__startswith=self.tp_path))\n\n    @property\n    def context_name(self):\n        return \"/projects%s\" % self.project_path\n\n\nclass ProjectSetDataTool(RelatedTPsDataTool):\n    group_by = (\"tp__project__code\", )\n    cache_key_name = \"projects\"\n\n    def get_root_child_path(self, child):\n        return child[self.group_by[0]]\n\n    @property\n    def context_name(self):\n        return \"ALL\"\n", "path": "pootle/apps/pootle_data/project_data.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n#\n# Copyright (C) Pootle contributors.\n#\n# This file is a part of the Pootle project. It is distributed under the GPL3\n# or later license. See the LICENSE file for a copy of the license and the\n# AUTHORS file for copyright and authorship information.\n\nfrom pootle.core.delegate import revision\n\nfrom .utils import RelatedStoresDataTool, RelatedTPsDataTool\n\n\nclass ProjectDataTool(RelatedTPsDataTool):\n    \"\"\"Retrieves aggregate stats for a Project\"\"\"\n\n    cache_key_name = \"project\"\n\n    def filter_data(self, qs):\n        return qs.filter(tp__project=self.context)\n\n    @property\n    def rev_cache_key(self):\n        return revision.get(\n            self.context.__class__)(self.context.directory).get(key=\"stats\")\n\n\nclass ProjectResourceDataTool(RelatedStoresDataTool):\n    group_by = (\"store__translation_project__language__code\", )\n    cache_key_name = \"project_resource\"\n\n    @property\n    def project_path(self):\n        return (\n            \"/%s%s\"\n            % (self.project_code, self.tp_path))\n\n    @property\n    def tp_path(self):\n        return (\n            \"/%s%s\"\n            % (self.dir_path,\n               self.filename))\n\n    def filter_data(self, qs):\n        return (\n            qs.filter(store__translation_project__project__code=self.project_code)\n              .filter(store__tp_path__startswith=self.tp_path))\n\n    @property\n    def context_name(self):\n        return \"/projects%s\" % self.project_path\n\n\nclass ProjectSetDataTool(RelatedTPsDataTool):\n    group_by = (\"tp__project__code\", )\n    cache_key_name = \"projects\"\n\n    def get_root_child_path(self, child):\n        return child[self.group_by[0]]\n\n    @property\n    def context_name(self):\n        return \"ALL\"\n\n    def filter_data(self, qs):\n        qs = super(ProjectSetDataTool, self).filter_data(qs)\n        return qs.exclude(tp__language__code=\"templates\")\n", "path": "pootle/apps/pootle_data/project_data.py"}]}