2
2
from mongoalchemy .fields import *
3
3
4
4
5
+ class Status (Document ):
6
+ new_activities = IntField ()
7
+ user_id = IntField ()
8
+
9
+ def to_dict (self ):
10
+ return {
11
+ 'new_activities' : self .new_activities
12
+ }
13
+
14
+
5
15
class Activity (Document ):
6
16
config_collection_name = 'activity'
7
17
config_polymorphic = 'type'
8
18
config_polymorphic_collection = True
9
19
10
- type = StringField (on_update = 'ignore' , )
11
- created_at = DateTimeField (on_update = 'ignore' )
12
- clicked = BoolField (required = True )
13
- user_id = IntField (on_update = 'ignore' )
20
+ type = StringField ()
21
+ created_at = DateTimeField ()
22
+ clicked = BoolField ()
23
+ user_id = IntField ()
14
24
15
25
16
26
class Like (Activity ):
17
27
config_polymorphic_identity = 'like'
18
28
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' )
29
+ performed_by = StringField ()
30
+ performer_avatar = StringField ()
31
+ post_id = IntField ()
32
+ post_image = StringField ()
23
33
24
34
def to_dict (self ):
25
35
return {
@@ -37,10 +47,10 @@ def to_dict(self):
37
47
class Comment (Activity ):
38
48
config_polymorphic_identity = 'comment'
39
49
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' )
50
+ performed_by = StringField ()
51
+ performer_avatar = StringField ()
52
+ post_id = IntField ()
53
+ post_image = StringField ()
44
54
45
55
def to_dict (self ):
46
56
return {
@@ -58,10 +68,10 @@ def to_dict(self):
58
68
class Repost (Activity ):
59
69
config_polymorphic_identity = 'repost'
60
70
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' )
71
+ performed_by = StringField ()
72
+ performer_avatar = StringField ()
73
+ post_id = IntField ()
74
+ post_image = StringField ()
65
75
66
76
def to_dict (self ):
67
77
return {
@@ -79,8 +89,8 @@ def to_dict(self):
79
89
class Follow (Activity ):
80
90
config_polymorphic_identity = 'follow'
81
91
82
- performed_by = StringField (on_update = 'ignore' )
83
- performer_avatar = StringField (on_update = 'ignore' )
92
+ performed_by = StringField ()
93
+ performer_avatar = StringField ()
84
94
85
95
def to_dict (self ):
86
96
return {
@@ -96,10 +106,10 @@ def to_dict(self):
96
106
class Mention (Activity ):
97
107
config_polymorphic_identity = 'mention'
98
108
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' )
109
+ performed_by = StringField ()
110
+ performer_avatar = StringField ()
111
+ post_id = IntField ()
112
+ post_image = StringField ()
103
113
104
114
def to_dict (self ):
105
115
return {
@@ -117,10 +127,10 @@ def to_dict(self):
117
127
class Badge (Activity ):
118
128
config_polymorphic_identity = 'badge'
119
129
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' )
130
+ badge_name = StringField ()
131
+ badge_image = StringField ()
132
+ post_id = IntField ()
133
+ post_image = StringField ()
124
134
125
135
def to_dict (self ):
126
136
return {
0 commit comments