diff options
-rw-r--r-- | askbot/models/post.py | 6 | ||||
-rw-r--r-- | askbot/views/users.py | 12 |
2 files changed, 13 insertions, 5 deletions
diff --git a/askbot/models/post.py b/askbot/models/post.py index d9cd9a5e..2b78e7a1 100644 --- a/askbot/models/post.py +++ b/askbot/models/post.py @@ -486,8 +486,8 @@ class Post(models.Model): if self.is_comment(): #todo: implement a custom delete method on these #all this should pack into Activity.responses.filter( somehow ).delete() - activity_types = const.RESPONSE_ACTIVITY_TYPES_FOR_DISPLAY - activity_types += (const.TYPE_ACTIVITY_MENTION,) + #activity_types = const.RESPONSE_ACTIVITY_TYPES_FOR_DISPLAY + #activity_types += (const.TYPE_ACTIVITY_MENTION,) #todo: not very good import in models of other models #todo: potentially a circular import from askbot.models.user import Activity @@ -495,7 +495,7 @@ class Post(models.Model): activities = Activity.objects.filter( content_type = comment_content_type, object_id = self.id, - activity_type__in = activity_types + #activity_type__in = activity_types ) recipients = set() diff --git a/askbot/views/users.py b/askbot/views/users.py index 154df7d8..c625aeab 100644 --- a/askbot/views/users.py +++ b/askbot/views/users.py @@ -354,8 +354,16 @@ def user_stats(request, user, context): for award in user_awards: # Fetch content object if award.content_type_id == post_type.id: - award.content_object = awarded_posts_map[award.object_id] - award.content_object_is_post = True + #here we go around a possibility of awards + #losing the content objects when the content + #objects are deleted for some reason + awarded_post = awarded_posts_map.get(award.object_id, None) + if awarded_post is not None: + #protect from awards that are associated with deleted posts + award.content_object = awarded_post + award.content_object_is_post = True + else: + award.content_object_is_post = False else: award.content_object_is_post = False |