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 <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2017-03-07 09:22:14 +13:00
parent 128f86adfc
commit b91b09a0ae

View File

@ -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):