Projet

Général

Profil

« Précédent | Suivant » 

Révision a3743177

Ajouté par Serghei Mihai (congés, retour 15/05) il y a plus de 9 ans

announce status computing methods

Voir les différences:

corbo/models.py
26 26
        return u'{title} ({id}) at {mtime}'.format(title=self.title,
27 27
                                    id=self.id, mtime=self.mtime)
28 28

  
29
    def is_published(self):
30
        if self.publication_time:
31
            if self.expiration_time:
32
                return self.publication_time <= timezone.now() < self.expiration_time
33
            return self.publication_time <= timezone.now()
34

  
35
    def is_expired(self):
36
        if self.expiration_time:
37
            return self.expiration_time > timezone.now()
38

  
39
    def is_not_published(self):
40
        return not self.publication_time
41

  
29 42
    class Meta:
30 43
        verbose_name = _('announce')
31 44
        ordering = ('-mtime',)

Formats disponibles : Unified diff