@@ -7,23 +7,23 @@ class Activity(Document):
7
7
config_polymorphic = 'type'
8
8
config_polymorphic_collection = True
9
9
10
- type = StringField (on_update = 'ignore' )
10
+ type = StringField (on_update = 'ignore' , )
11
11
created_at = DateTimeField (on_update = 'ignore' )
12
- clicked = BoolField ()
12
+ clicked = BoolField (required = True )
13
13
user_id = IntField (on_update = 'ignore' )
14
14
15
15
16
16
class Like (Activity ):
17
17
config_polymorphic_identity = 'like'
18
18
19
- performed_by = StringField ()
20
- performer_avatar = StringField ()
21
- post_id = IntField ()
22
- post_image = StringField ()
19
+ performed_by = StringField (on_update = 'ignore' )
20
+ performer_avatar = StringField (on_update = 'ignore' )
21
+ post_id = IntField (on_update = 'ignore' )
22
+ post_image = StringField (on_update = 'ignore' )
23
23
24
24
def to_dict (self ):
25
25
return {
26
- 'id' : self .mongo_id . __str__ ( ),
26
+ 'id' : str ( self .mongo_id ),
27
27
'type' : self .type ,
28
28
'performed_by' : self .performed_by ,
29
29
'performer_avatar' : self .performer_avatar ,
@@ -37,14 +37,14 @@ def to_dict(self):
37
37
class Comment (Activity ):
38
38
config_polymorphic_identity = 'comment'
39
39
40
- performed_by = StringField ()
41
- performer_avatar = StringField ()
42
- post_id = IntField ()
43
- post_image = StringField ()
40
+ performed_by = StringField (on_update = 'ignore' )
41
+ performer_avatar = StringField (on_update = 'ignore' )
42
+ post_id = IntField (on_update = 'ignore' )
43
+ post_image = StringField (on_update = 'ignore' )
44
44
45
45
def to_dict (self ):
46
46
return {
47
- 'id' : self .mongo_id . __str__ ( ),
47
+ 'id' : str ( self .mongo_id ),
48
48
'type' : self .type ,
49
49
'performed_by' : self .performed_by ,
50
50
'performer_avatar' : self .performer_avatar ,
@@ -58,14 +58,14 @@ def to_dict(self):
58
58
class Repost (Activity ):
59
59
config_polymorphic_identity = 'repost'
60
60
61
- performed_by = StringField ()
62
- performer_avatar = StringField ()
63
- post_id = IntField ()
64
- post_image = StringField ()
61
+ performed_by = StringField (on_update = 'ignore' )
62
+ performer_avatar = StringField (on_update = 'ignore' )
63
+ post_id = IntField (on_update = 'ignore' )
64
+ post_image = StringField (on_update = 'ignore' )
65
65
66
66
def to_dict (self ):
67
67
return {
68
- 'id' : self .mongo_id . __str__ ( ),
68
+ 'id' : str ( self .mongo_id ),
69
69
'type' : self .type ,
70
70
'performed_by' : self .performed_by ,
71
71
'performer_avatar' : self .performer_avatar ,
@@ -79,12 +79,12 @@ def to_dict(self):
79
79
class Follow (Activity ):
80
80
config_polymorphic_identity = 'follow'
81
81
82
- performed_by = StringField ()
83
- performer_avatar = StringField ()
82
+ performed_by = StringField (on_update = 'ignore' )
83
+ performer_avatar = StringField (on_update = 'ignore' )
84
84
85
85
def to_dict (self ):
86
86
return {
87
- 'id' : self .mongo_id . __str__ ( ),
87
+ 'id' : str ( self .mongo_id ),
88
88
'type' : self .type ,
89
89
'performed_by' : self .performed_by ,
90
90
'performer_avatar' : self .performer_avatar ,
@@ -96,14 +96,14 @@ def to_dict(self):
96
96
class Mention (Activity ):
97
97
config_polymorphic_identity = 'mention'
98
98
99
- performed_by = StringField ()
100
- performer_avatar = StringField ()
101
- post_id = IntField ()
102
- post_image = StringField ()
99
+ performed_by = StringField (on_update = 'ignore' )
100
+ performer_avatar = StringField (on_update = 'ignore' )
101
+ post_id = IntField (on_update = 'ignore' )
102
+ post_image = StringField (on_update = 'ignore' )
103
103
104
104
def to_dict (self ):
105
105
return {
106
- 'id' : self .mongo_id . __str__ ( ),
106
+ 'id' : str ( self .mongo_id ),
107
107
'type' : self .type ,
108
108
'performed_by' : self .performed_by ,
109
109
'performer_avatar' : self .performer_avatar ,
@@ -117,10 +117,10 @@ def to_dict(self):
117
117
class Badge (Activity ):
118
118
config_polymorphic_identity = 'badge'
119
119
120
- badge_name = StringField ()
121
- badge_image = StringField ()
122
- post_id = IntField ()
123
- post_image = StringField ()
120
+ badge_name = StringField (on_update = 'ignore' )
121
+ badge_image = StringField (on_update = 'ignore' )
122
+ post_id = IntField (on_update = 'ignore' )
123
+ post_image = StringField (on_update = 'ignore' )
124
124
125
125
def to_dict (self ):
126
126
return {
0 commit comments