Add sort priority field to branch model

This enables sorting the branch drop-down in a configurable manner (e.g.
so that you can have them in order from newest to oldest).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-03-06 22:56:31 +00:00
parent f6fb84db4b
commit af499c0d99
2 changed files with 2 additions and 1 deletions

View File

@ -11,7 +11,7 @@ def layerindex_context(request):
if not current_branch:
current_branch = 'master'
return {
'all_branches': Branch.objects.all(),
'all_branches': Branch.objects.all().order_by('sort_priority'),
'current_branch': current_branch,
'unpublished_count': LayerItem.objects.filter(status='N').count(),
}

View File

@ -15,6 +15,7 @@ class Branch(models.Model):
name = models.CharField(max_length=50)
bitbake_branch = models.CharField(max_length=50)
short_description = models.CharField(max_length=50, blank=True)
sort_priority = models.IntegerField(blank=True, null=True)
class Meta:
verbose_name_plural = "Branches"