rrs: fix broken links when there are no milestones in a release

If a release has no milestones, we shouldn't be selecting it as the
default to be linked to in the maintenance plan drop-down, so filter
those out.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2018-09-05 15:28:18 +12:00
parent 575b6bc180
commit dac47659ca

View File

@ -33,7 +33,7 @@ class MaintenancePlan(models.Model):
maintainer_style = models.CharField(max_length=1, choices=MAINTENANCEPLAN_MAINTAINER_STYLE, default='L', help_text='Maintainer tracking style for the layers within this plan')
def get_default_release(self):
return self.release_set.last()
return self.release_set.filter(milestone__isnull=False).last()
def per_recipe_maintainers(self):
return self.maintainer_style != 'L'