forked from j2labs/listsurf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
67 lines (52 loc) · 1.59 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from dictshield.document import Document, diff_id_field
from dictshield.fields import (BaseField,
StringField,
BooleanField,
URLField,
EmailField,
LongField)
# this might get moved
from dictshield.fields.mongo import ObjectIdField
from brubeck.timekeeping import MillisecondField
###
### Social Models
###
@diff_id_field(ObjectIdField, ['id'])
class UserProfile(Document):
"""A UserProfile is essentially any publicly available info about the user.
Stored in a document separate from the User itself for security.
"""
# ownable
owner = ObjectIdField(required=True)
username = StringField(max_length=30, required=True)
# streamable
created_at = MillisecondField()
updated_at = MillisecondField()
# unique fields
name = StringField(max_length=100)
location = StringField(max_length=100)
website = URLField()
_private_fields = [
'owner',
]
def __unicode__(self):
return u'%s' % (self.username)
###
### List Models
###
@diff_id_field(ObjectIdField, ['id'])
class ListItem(Document):
"""Bare minimum to have the concept of streamed item.
"""
# ownable
owner = ObjectIdField(required=True)
username = StringField(max_length=30, required=True)
# streamable
created_at = MillisecondField()
updated_at = MillisecondField()
url = URLField()
_private_fields = [
'owner',
]
def __unicode__(self):
return u'%s' % (self.url)