rrs/models.py: RecipeMaintainerHistory if not found return the first record

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
Aníbal Limón 2015-02-17 13:11:05 +00:00 committed by Paul Eggleton
parent 8def265a02
commit f042c706da

View File

@ -153,6 +153,11 @@ class RecipeMaintainerHistory(models.Model):
rmh_qry = RecipeMaintainerHistory.objects.filter(
date__lte = end_date).order_by('-date')
if rmh_qry:
return rmh_qry[0]
rmh_qry = RecipeMaintainerHistory.objects.filter(
).order_by('date')
if rmh_qry:
return rmh_qry[0]
else: