Project

General

Profile

« Previous | Next » 

Revision a4233531

Added by Benjamin Dauvergne over 11 years ago

actes: change the unicode method of ActValidationState

View differences:

calebasse/actes/models.py
32 32
    auto = models.BooleanField(default=False,
33 33
            verbose_name=u'VĂ©rouillage')
34 34

  
35
    def __unicode__(self):
35
    def __repr__(self):
36 36
        return self.state_name + ' ' + str(self.created)
37 37

  
38
    def __unicode__(self):
39
        return VALIDATION_STATES[self.state_name]
40

  
38 41

  
39 42
class Act(models.Model):
40 43
    patient = models.ForeignKey('dossiers.PatientRecord')
......
327 330
        return '<%s %r %r>' % (self.__class__.__name__, unicode(self),
328 331
            self.id)
329 332

  
333
    def start_time(self):
334
        return self.occurrence_set.all()[0].start_time
335

  
336
    def duration(self):
337
        o = self.occurrence_set.all()[0]
338
        td = o.end_time - o.start_time
339
        hours, remainder = divmod(td.seconds, 3600)
340
        minutes, remainder = divmod(remainder, 60)
341
        return '%02d:%02d' % (hours, minutes)
342

  
330 343
    class Meta:
331 344
        verbose_name = 'Rendez-vous patient'
332 345
        verbose_name_plural = 'Rendez-vous patient'

Also available in: Unified diff