From b91b09a0aec11c0f8ee0cb99aa4ec81be9d23ddc Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 7 Mar 2017 09:22:14 +1300 Subject: [PATCH] models.py: minor branch tweaks Make minor (non-structural) improvements to the model, mostly for the benefit of the admin interface: * Set default ordering so that branches appear in the same order they do in the user-facing drop-down * Include the description in the default string representation (so you know which branch name matches with which Yocto Project version, in the OE index). Signed-off-by: Paul Eggleton --- layerindex/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/layerindex/models.py b/layerindex/models.py index 96a1933..b60ad01 100644 --- a/layerindex/models.py +++ b/layerindex/models.py @@ -42,9 +42,13 @@ class Branch(models.Model): class Meta: verbose_name_plural = "Branches" + ordering = ['sort_priority'] def __str__(self): - return self.name + if self.short_description: + return '%s (%s)' % (self.name, self.short_description) + else: + return self.name class Update(models.Model):