Projet

Général

Profil

« Précédent | Suivant » 

Révision 46bbe5fe

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

announce broadcasting channels added

Voir les différences:

corbo/models.py
5 5

  
6 6
from ckeditor.fields import RichTextField
7 7

  
8
import channels
9

  
8 10
class Category(models.Model):
9 11
    name = models.CharField(max_length=64, blank=False, null=False)
10 12
    ctime = models.DateTimeField(auto_now_add=True)
......
13 15
        return self.name
14 16

  
15 17
class Announce(models.Model):
18
    category  = models.ForeignKey('Category', verbose_name=_('category'))
16 19
    title = models.CharField(_('title'), max_length=256,
17 20
                             help_text=_('maximum 256 characters'))
18
    text = RichTextField(_('Content'))
21
    text = models.TextField(_('Content'))
19 22
    publication_time = models.DateTimeField(_('publication time'), blank=True,
20 23
                                            null=True)
21 24
    expiration_time = models.DateTimeField(_('Expires on'), blank=True,
22 25
                                           null=True)
23 26
    ctime = models.DateTimeField(_('creation time'), auto_now_add=True)
24 27
    mtime = models.DateTimeField(_('modification time'), auto_now=True)
25
    category  = models.ForeignKey('Category', verbose_name=_('category'))
26 28

  
27 29
    def __unicode__(self):
28 30
        return u'{title} ({id}) at {mtime}'.format(title=self.title,
......
44 46
        verbose_name = _('announce')
45 47
        ordering = ('-mtime',)
46 48

  
49
class Broadcast(models.Model):
50
    announce = models.ForeignKey(Announce, verbose_name=_('announce'))
51
    channel = models.CharField(_('channel'), max_length=32,
52
            choices=channels.get_channel_choices(), blank=False)
53
    time = models.DateTimeField(_('sent time'), auto_now_add=True)
54
    result = models.TextField(_('result'), blank=True)
55

  
56
    def __unicode__(self):
57
        return u'announce {id} sent via {channel} at {time}'.format(
58
                id=self.announce.id, channel=self.channel, time=self.time)
59

  
60
    class Meta:
61
        verbose_name = _('sent')
62
        ordering = ('-time',)
63
        unique_together = ('announce', 'channel')
64

  
47 65
class SubscriptionType(models.Model):
48 66
    subscription = models.ForeignKey('Subscription')
49 67
    identifier = models.CharField(_('identifier'), max_length=128, blank=True,

Formats disponibles : Unified diff