Commit 78a24a2f authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

query_sums

parent 60328677
from django.db import models
from ndh.models import TimeStampedModel, NamedModel
from ndh.utils import query_sum
class Project(NamedModel):
......@@ -24,6 +25,12 @@ class Package(NamedModel, TimeStampedModel):
class Meta:
ordering = ('name',)
def open_pr(self):
return query_sum(self.repo_set, 'open_pr')
def open_issues(self):
return query_sum(self.repo_set, 'open_issues')
class Repo(TimeStampedModel):
package = models.ForeignKey(Package)
......
......@@ -3,8 +3,8 @@
<div class="package-name">{{ package }}</div>
<div class=""></div>
<div class="package-homepage">{{ package.homepage|domain }}</div>
<div class=""></div>
<div class=""></div>
<div class="package-issues">{{ package.open_issues }}</div>
<div class="package-pr">{{ package.open_pr }}</div>
<div class="package-license">{{ package.license|default_if_none:'?' }}</div>
{% for repo in package.repo_set.all %}
{% include 'gepetto_packages/repo.html' with repo=repo %}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment