]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
models: Remove Bundle.n_patches
authorStephen Finucane <stephen@that.guru>
Thu, 20 Oct 2016 07:28:54 +0000 (08:28 +0100)
committerStephen Finucane <stephen@that.guru>
Sat, 22 Oct 2016 10:22:50 +0000 (11:22 +0100)
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>
patchwork/models.py
patchwork/templates/patchwork/bundles.html
patchwork/views/xmlrpc.py

index 6f3257f9514c08eb2499f1d433e59656a99ad6c4..51f974504302b3fbeab0395230797010f2330ff6 100644 (file)
@@ -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')
 
index 2eebd262f3bd247738a9ba95cccb1151e1926c57..45bdec512c32a6ce3a1c539fa0998009abd97553 100644 (file)
@@ -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"
index cfb80d3acf02afa6ac155cb52fb5ce35cfe569bc..30829e7fd94e61b4663702fe6a90911008e4f24d 100644 (file)
@@ -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(),
     }