@@ -570,9 +570,6 @@ class Bundle(models.Model):
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')
@@ -27,7 +27,7 @@
<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"
@@ -311,7 +311,7 @@ def bundle_to_dict(obj):
return {
'id': obj.id,
'name': obj.name,
- 'n_patches': obj.n_patches(),
+ 'n_patches': obj.patches.count(),
'public_url': obj.public_url(),
}