Stephen Finucane <step...@that.guru> writes:

> It doesn't really do much for us. Less LOC = win.
>
Reviewed-by: Daniel Axtens <d...@axtens.net>
> Signed-off-by: Stephen Finucane <step...@that.guru>
> ---
>  patchwork/models.py                        | 3 ---
>  patchwork/templates/patchwork/bundles.html | 2 +-
>  patchwork/views/xmlrpc.py                  | 2 +-
>  3 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/patchwork/models.py b/patchwork/models.py
> index 2a98eff..3c554af 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -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')
>  
> diff --git a/patchwork/templates/patchwork/bundles.html 
> b/patchwork/templates/patchwork/bundles.html
> index 2eebd26..45bdec5 100644
> --- a/patchwork/templates/patchwork/bundles.html
> +++ b/patchwork/templates/patchwork/bundles.html
> @@ -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"
> diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
> index cfb80d3..30829e7 100644
> --- a/patchwork/views/xmlrpc.py
> +++ b/patchwork/views/xmlrpc.py
> @@ -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(),
>      }
>  
> -- 
> 2.7.4
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Patchwork mailing list
Patchwork@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/patchwork

Reply via email to