comparison forums/tools.py @ 1001:c6c3ba5cf6eb

V2 news stories use forums for comments.
author Brian Neal <bgneal@gmail.com>
date Thu, 26 Nov 2015 00:27:42 -0600
parents 9e803323a0d0
children
comparison
equal deleted inserted replaced
1000:abd4c02aefdb 1001:c6c3ba5cf6eb
86 'post_body' - topic post body (as markup, not HTML) 86 'post_body' - topic post body (as markup, not HTML)
87 'ip' - IP address for the post (as a string) 87 'ip' - IP address for the post (as a string)
88 'sticky' - if True, the post will be stickied 88 'sticky' - if True, the post will be stickied
89 'locked' - if True, the post will be locked 89 'locked' - if True, the post will be locked
90 90
91 The new topic is returned.
91 """ 92 """
92 try: 93 try:
93 forum = Forum.objects.get(slug=forum_slug) 94 forum = Forum.objects.get(slug=forum_slug)
94 except Forum.DoesNotExist: 95 except Forum.DoesNotExist:
95 logging.error('could not create_topic for forum_slug=%s', forum_slug) 96 logging.error('could not create_topic for forum_slug=%s', forum_slug)
108 user_ip=ip) 109 user_ip=ip)
109 post.save() 110 post.save()
110 111
111 notify_new_topic(topic) 112 notify_new_topic(topic)
112 notify_new_post(post) 113 notify_new_post(post)
114 return topic
113 115
114 116
115 def auto_favorite(post): 117 def auto_favorite(post):
116 """ 118 """
117 Given a newly created post, perform an auto-favorite action if the post 119 Given a newly created post, perform an auto-favorite action if the post