aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2013-01-29 21:23:21 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2013-01-29 21:23:21 +0100
commitff68ca9fc2b329d1c2ec395abf50358845c4e5fc (patch)
tree7bcdc92562283796c58c119c3dce025ae6e45824
parente9b4e50007405d548572ad874bdf7d76f6668b27 (diff)
downloadmediagoblin-ff68ca9fc2b329d1c2ec395abf50358845c4e5fc.tar.lz
mediagoblin-ff68ca9fc2b329d1c2ec395abf50358845c4e5fc.tar.xz
mediagoblin-ff68ca9fc2b329d1c2ec395abf50358845c4e5fc.zip
Fix issue 611: Proper (back)relationship on MediaComment.
well, fix the relationship on the comments.
-rw-r--r--mediagoblin/db/models.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index de491e96..101e7cee 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -393,7 +393,13 @@ class MediaComment(Base, MediaCommentMixin):
created = Column(DateTime, nullable=False, default=datetime.datetime.now)
content = Column(UnicodeText, nullable=False)
- get_author = relationship(User)
+ # Cascade: Comments are owned by their creator. So do the full thing.
+ # lazy=dynamic: People might post a *lot* of comments, so make
+ # the "posted_comments" a query-like thing.
+ get_author = relationship(User,
+ backref=backref("posted_comments",
+ lazy="dynamic",
+ cascade="all, delete-orphan"))
class Collection(Base, CollectionMixin):