File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright The IETF Trust 2020, All Rights Reserved
2+ # -*- coding: utf-8 -*-
3+ # Generated by Django 1.11.27 on 2020-02-22 09:29
4+ from __future__ import unicode_literals
5+
6+ from django .db import migrations , models
7+
8+
9+ class Migration (migrations .Migration ):
10+
11+ dependencies = [
12+ ('message' , '0006_remove_docs2_m2m' ),
13+ ]
14+
15+ operations = [
16+ migrations .AddField (
17+ model_name = 'message' ,
18+ name = 'sent' ,
19+ field = models .DateTimeField (blank = True , null = True ),
20+ ),
21+ ]
Original file line number Diff line number Diff line change 1+ # Copyright The IETF Trust 2020, All Rights Reserved
2+ # -*- coding: utf-8 -*-
3+ # Generated by Django 1.11.20 on 2019-05-21 14:27
4+
5+
6+ from __future__ import absolute_import , print_function , unicode_literals
7+
8+ from tqdm import tqdm
9+
10+ from django .db import migrations
11+
12+
13+ def forward (apps , schema_editor ):
14+
15+ Message = apps .get_model ('message' , 'Message' )
16+
17+ for m in tqdm (Message .objects .filter (sent = None )):
18+ if m .sendqueue_set .exists ():
19+ q = m .sendqueue_set .last ()
20+ m .sent = q .sent_at
21+ else :
22+ m .sent = m .time
23+ m .save ()
24+
25+ def reverse (apps , schema_editor ):
26+ pass
27+
28+ class Migration (migrations .Migration ):
29+
30+ dependencies = [
31+ ('message' , '0007_message_sent' ),
32+ ]
33+
34+ operations = [
35+ migrations .RunPython (forward , reverse ),
36+ ]
Original file line number Diff line number Diff line change 1- # Copyright The IETF Trust 2012-2019 , All Rights Reserved
1+ # Copyright The IETF Trust 2012-2020 , All Rights Reserved
22# -*- coding: utf-8 -*-
33
44
@@ -37,6 +37,8 @@ class Message(models.Model):
3737 related_groups = models .ManyToManyField (Group , blank = True )
3838 related_docs = models .ManyToManyField (Document , blank = True )
3939
40+ sent = models .DateTimeField (blank = True , null = True )
41+
4042 class Meta :
4143 ordering = ['time' ]
4244
You can’t perform that action at this time.
0 commit comments