Mercurial > public > sg101
comparison gpp/forums/tools.py @ 285:8fd4984d5c3b
This is a first rough commit for #95, adding the ability to embed YouTube videos in forum posts. Some more polish and testing needs to happen at this point. I wanted to get all these changes off my hard drive and into the repository.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 14 Oct 2010 02:39:35 +0000 |
parents | d77e0dc772ad |
children | 767cedc7d12a |
comparison
equal
deleted
inserted
replaced
284:df2c81f705a8 | 285:8fd4984d5c3b |
---|---|
12 It also cleans up any last visit database records for the user. | 12 It also cleans up any last visit database records for the user. |
13 This function adjusts the last post foreign keys before deleting | 13 This function adjusts the last post foreign keys before deleting |
14 the posts to avoid the cascading delete behavior. | 14 the posts to avoid the cascading delete behavior. |
15 """ | 15 """ |
16 posts = Post.objects.filter(user=user).select_related() | 16 posts = Post.objects.filter(user=user).select_related() |
17 | |
18 # delete attachments | |
19 for post in posts: | |
20 post.attachments.clear() | |
17 | 21 |
18 # build a set of topics and forums affected by the post deletions | 22 # build a set of topics and forums affected by the post deletions |
19 | 23 |
20 topics = set(post.topic for post in posts) | 24 topics = set(post.topic for post in posts) |
21 forums = set(topic.forum for topic in topics) | 25 forums = set(topic.forum for topic in topics) |