[3/3] ui: Add version to series name

Submitted by Stephen Finucane on Nov. 18, 2016, 1:18 a.m.

Details

Message ID 1479431925-24865-3-git-send-email-stephen@that.guru
State New
Headers show

Commit Message

Stephen Finucane Nov. 18, 2016, 1:18 a.m.
There's no way to distinguish between different patch versions in the
UI if those patches are using cover letter or user-based names. We
can't store the version as part of the name (in the database) at this
has the potential to change, so the version must be populated
manually. This results in some duplication for series with patch-based
names but this is an acceptable compromise.

Signed-off-by: Stephen Finucane <stephen@that.guru>
---
 patchwork/models.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Doan Nov. 22, 2016, 5:38 p.m.
On 11/17/2016 07:18 PM, Stephen Finucane wrote:
> There's no way to distinguish between different patch versions in the
> UI if those patches are using cover letter or user-based names. We
> can't store the version as part of the name (in the database) at this
> has the potential to change, so the version must be populated
> manually. This results in some duplication for series with patch-based
> names but this is an acceptable compromise.
>
> Signed-off-by: Stephen Finucane <stephen@that.guru>
> ---
>  patchwork/models.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/patchwork/models.py b/patchwork/models.py
> index d1d0857..05809e2 100644
> --- a/patchwork/models.py
> +++ b/patchwork/models.py
> @@ -686,7 +686,8 @@ class Series(models.Model):
>                                            number=number)
>
>      def __str__(self):
> -        return self.name if self.name else 'Untitled series #%d' % self.id
> +        return ('%s (v%d)' % (self.name, self.version) if self.name
> +                else 'Untitled series #%d' % self.id)

I really like the idea of the series and have been needing it. One small 
bike-shed: It seems like you'd want to version to be at the first of the 
string and not the end. I assume you tried both and this works better 
though?

Patch hide | download patch | download mbox

diff --git a/patchwork/models.py b/patchwork/models.py
index d1d0857..05809e2 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -686,7 +686,8 @@  class Series(models.Model):
                                           number=number)
 
     def __str__(self):
-        return self.name if self.name else 'Untitled series #%d' % self.id
+        return ('%s (v%d)' % (self.name, self.version) if self.name
+                else 'Untitled series #%d' % self.id)
 
     class Meta:
         ordering = ('date',)