prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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!
  
  </issue>
  <code>
  [start of pootle/apps/pootle_data/project_data.py]
  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 of pootle/apps/pootle_data/project_data.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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")
  
verification_info: {"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"}]}