diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-07-02 14:39:35 -0500 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2011-07-02 14:39:35 -0500 |
commit | 2110408f4437a9bd7d4d158139cf869518c46456 (patch) | |
tree | 2bcd83b06b993c37f1307acdff9d2f9c9e5c8096 /mediagoblin/db/models.py | |
parent | 29f9df7b27a443b8e7de793c99bc7606ebcf36cb (diff) | |
parent | 6f59a3a32470b4d83ab94fe7c4dae83943500329 (diff) | |
download | mediagoblin-2110408f4437a9bd7d4d158139cf869518c46456.tar.lz mediagoblin-2110408f4437a9bd7d4d158139cf869518c46456.tar.xz mediagoblin-2110408f4437a9bd7d4d158139cf869518c46456.zip |
Merge remote branch 'remotes/jwandborg/feature_362-simple_comments-acts_on_feedback'
Conflicts:
mediagoblin/templates/mediagoblin/user_pages/media.html
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r-- | mediagoblin/db/models.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index bf825a23..1d91a14b 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -23,7 +23,6 @@ from mediagoblin.auth import lib as auth_lib from mediagoblin import mg_globals from mediagoblin.db import migrations from mediagoblin.db.util import DESCENDING, ObjectId -from mediagoblin.util import Pagination ################### # Custom validators @@ -109,24 +108,13 @@ class MediaEntry(Document): migration_handler = migrations.MediaEntryMigration + def get_comments(self): + return self.db.MediaComment.find({ + 'media_entry': self['_id']}).sort('created', DESCENDING) + def main_mediafile(self): pass - - def get_comments(self, page): - cursor = self.db.MediaComment.find({ - 'media_entry': self['_id']}).sort('created', DESCENDING) - - pagination = Pagination(page, cursor) - comments = pagination() - - data = list() - for comment in comments: - comment['author'] = self.db.User.find_one({ - '_id': comment['author']}) - data.append(comment) - - return (data, pagination) - + def generate_slug(self): self['slug'] = util.slugify(self['title']) |