aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db/models.py
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2011-06-02 14:33:26 +0200
committerElrond <elrond+mediagoblin.org@samba-tng.org>2011-06-02 14:41:50 +0200
commit7fd6f623f1cb558360c940a6dd1dc6c1e74fe31b (patch)
tree89c29354c416cbcbf2eb0827e61c7084a80fdf22 /mediagoblin/db/models.py
parentc849e690925cb656b8c00ccbeda12aeab22c2fdd (diff)
parent4d4b49a84e2791da6b12ef580565251c379264b6 (diff)
downloadmediagoblin-7fd6f623f1cb558360c940a6dd1dc6c1e74fe31b.tar.lz
mediagoblin-7fd6f623f1cb558360c940a6dd1dc6c1e74fe31b.tar.xz
mediagoblin-7fd6f623f1cb558360c940a6dd1dc6c1e74fe31b.zip
Merge remote branch 'upstream/master'
Conflicts: mediagoblin/templates/mediagoblin/user_pages/media.html
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r--mediagoblin/db/models.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index 37420834..0b85430a 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -64,6 +64,14 @@ class User(Document):
return auth_lib.bcrypt_check_password(
password, self['pw_hash'])
+ def generate_new_verification_key(self):
+ """
+ Create a new verification key, overwriting the old one.
+ """
+
+ self['verification_key'] = unicode(uuid.uuid4())
+ self.save(validate=False)
+
class MediaEntry(Document):
__collection__ = 'media_entries'
@@ -95,7 +103,7 @@ class MediaEntry(Document):
'thumbnail_file': [unicode]}
required_fields = [
- 'uploader', 'created', 'media_type']
+ 'uploader', 'created', 'media_type', 'slug']
default_values = {
'created': datetime.datetime.utcnow,
@@ -103,11 +111,10 @@ class MediaEntry(Document):
migration_handler = migrations.MediaEntryMigration
- # Actually we should referene uniqueness by uploader, but we
- # should fix http://bugs.foocorp.net/issues/340 first.
- # indexes = [
- # {'fields': ['uploader', 'slug'],
- # 'unique': True}]
+ indexes = [
+ # Referene uniqueness of slugs by uploader
+ {'fields': ['uploader', 'slug'],
+ 'unique': True}]
def main_mediafile(self):
pass