Add total logbook + logbook inline in teacher admin

This commit is contained in:
Claude Paroz 2018-02-19 10:28:14 +01:00
parent b50dd1a619
commit 718ba80dba
3 changed files with 17 additions and 2 deletions

View file

@ -143,6 +143,10 @@ class Teacher(models.Model):
return (self.calc_activity(), imputations)
def total_logbook(self):
return LogBook.objects.filter(teacher=self).aggregate(models.Sum('nb_period'))['nb_period__sum']
total_logbook.short_description = 'Solde du carnet du lait'
class LogBookReason(models.Model):
name = models.CharField('Motif', max_length=50, unique=True)