migration_handler = migrations.MediaEntryMigration
- indexes = [
- # Referene uniqueness of slugs by uploader
- {'fields': ['uploader', 'slug'],
- 'unique': True}]
-
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'])