It doesn't really do much for us. Less LOC = win.
Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Daniel Axtens <dja@axtens.net>
patches = models.ManyToManyField(Patch, through='BundlePatch')
public = models.BooleanField(default=False)
- def n_patches(self):
- return self.patches.all().count()
-
def ordered_patches(self):
return self.patches.order_by('bundlepatch__order')
<a href="{{ bundle.public_url }}">{{ bundle.public_url }}</a>
{% endif %}
</td>
- <td style="text-align: right">{{ bundle.n_patches }}</td>
+ <td style="text-align: right">{{ bundle.patches.count }}</td>
<td style="text-align: center;"><a
href="{% url 'bundle-mbox' username=bundle.owner.username bundlename=bundle.name %}"
><img src="{% static "images/16-em-down.png" %}" width="16" height="16" alt="download"
return {
'id': obj.id,
'name': obj.name,
- 'n_patches': obj.n_patches(),
+ 'n_patches': obj.patches.count(),
'public_url': obj.public_url(),
}