Révision 0b074678
Ajouté par Serghei Mihai (congés, retour 15/05) il y a presque 8 ans
corbo/migrations/0005_auto_20160504_1747.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
from __future__ import unicode_literals |
|
3 |
|
|
4 |
from django.db import models, migrations |
|
5 |
|
|
6 |
|
|
7 |
class Migration(migrations.Migration): |
|
8 |
|
|
9 |
dependencies = [ |
|
10 |
('corbo', '0004_auto_20160504_1744'), |
|
11 |
] |
|
12 |
|
|
13 |
operations = [ |
|
14 |
migrations.AlterModelOptions( |
|
15 |
name='broadcast', |
|
16 |
options={'ordering': ('-deliver_time',), 'verbose_name': 'sent'}, |
|
17 |
), |
|
18 |
migrations.RemoveField( |
|
19 |
model_name='broadcast', |
|
20 |
name='time', |
|
21 |
), |
|
22 |
migrations.AddField( |
|
23 |
model_name='broadcast', |
|
24 |
name='deliver_time', |
|
25 |
field=models.DateTimeField(null=True, verbose_name='Deliver time'), |
|
26 |
preserve_default=True, |
|
27 |
), |
|
28 |
] |
corbo/models.py | ||
---|---|---|
53 | 53 |
|
54 | 54 |
class Broadcast(models.Model): |
55 | 55 |
announce = models.ForeignKey(Announce, verbose_name=_('announce')) |
56 |
time = models.DateTimeField(_('sent time'), auto_now_add=True)
|
|
56 |
deliver_time = models.DateTimeField(_('Deliver time'), null=True)
|
|
57 | 57 |
result = models.TextField(_('result'), blank=True) |
58 | 58 |
|
59 | 59 |
def __unicode__(self): |
60 |
return u'announce {id} sent via {channel} at {time}'.format( |
|
61 |
id=self.announce.id, channel=self.channel, time=self.time) |
|
60 |
if self.deliver_time: |
|
61 |
return u'announce {id} delivered via at {time}'.format( |
|
62 |
id=self.announce.id, time=self.deliver_time) |
|
63 |
return u'announce {id} to deliver'.format(id=self.announce.id) |
|
62 | 64 |
|
63 | 65 |
class Meta: |
64 | 66 |
verbose_name = _('sent') |
65 |
ordering = ('-time',) |
|
67 |
ordering = ('-deliver_time',)
|
|
66 | 68 |
|
67 | 69 |
|
68 | 70 |
class Subscription(models.Model): |
Formats disponibles : Unified diff
rename broadcast attributes