aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/models.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2011-04-23 08:52:23 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2011-04-23 08:52:23 -0500
commit4d75522b91c13c365f79929bd7760ac6090b2a8b (patch)
tree5149df3775a49bf3ce9b0f32268d39d1c079cca7 /mediagoblin/models.py
parent7eba0306d84adb35af9d1ad2568f11f0cdd2f7a7 (diff)
downloadmediagoblin-4d75522b91c13c365f79929bd7760ac6090b2a8b.tar.lz
mediagoblin-4d75522b91c13c365f79929bd7760ac6090b2a8b.tar.xz
mediagoblin-4d75522b91c13c365f79929bd7760ac6090b2a8b.zip
Give User a status, also add uploader user field to MediaEntry
Diffstat (limited to 'mediagoblin/models.py')
-rw-r--r--mediagoblin/models.py55
1 files changed, 30 insertions, 25 deletions
diff --git a/mediagoblin/models.py b/mediagoblin/models.py
index d5f87a90..364f7ebf 100644
--- a/mediagoblin/models.py
+++ b/mediagoblin/models.py
@@ -21,30 +21,6 @@ from mongokit import Document, Set
from mediagoblin.auth import lib as auth_lib
-class MediaEntry(Document):
- __collection__ = 'media_entries'
-
- structure = {
- 'title': unicode,
- 'created': datetime.datetime,
- 'description': unicode,
- 'media_type': unicode,
- 'media_data': dict, # extra data relevant to this media_type
- 'plugin_data': dict, # plugins can dump stuff here.
- 'file_store': unicode,
- 'attachments': [dict],
- 'tags': [unicode]}
-
- required_fields = [
- 'title', 'created',
- 'media_type', 'file_store']
-
- default_values = {
- 'created': datetime.datetime.utcnow}
-
- def main_mediafile(self):
- pass
-
class User(Document):
__collection__ = 'users'
@@ -55,13 +31,16 @@ class User(Document):
'plugin_data': dict, # plugins can dump stuff here.
'pw_hash': unicode,
'email_verified': bool,
+ 'status': unicode,
}
required_fields = ['username', 'created', 'pw_hash', 'email']
default_values = {
'created': datetime.datetime.utcnow,
- 'email_verified': False}
+ 'email_verified': False,
+ # TODO: shouldn't be active by default, must have email registration
+ 'status': 'active'}
def check_login(self, password):
"""
@@ -71,6 +50,32 @@ class User(Document):
password, self['pw_hash'])
+class MediaEntry(Document):
+ __collection__ = 'media_entries'
+
+ structure = {
+ 'uploader': User,
+ 'title': unicode,
+ 'created': datetime.datetime,
+ 'description': unicode,
+ 'media_type': unicode,
+ 'media_data': dict, # extra data relevant to this media_type
+ 'plugin_data': dict, # plugins can dump stuff here.
+ 'file_store': unicode,
+ 'attachments': [dict],
+ 'tags': [unicode]}
+
+ required_fields = [
+ 'title', 'created',
+ 'media_type', 'file_store']
+
+ default_values = {
+ 'created': datetime.datetime.utcnow}
+
+ def main_mediafile(self):
+ pass
+
+
REGISTER_MODELS = [MediaEntry, User]