to_dict: Update rendered_content in the database after rendered.

This change could significantly load the database if pushed to prod at
the same time as:

    send_message: Save rendered message content to the database.

goes out.  So this should go out in a different prod push from that
commit.

(imported from commit 4e5a370bc43defb5083cac3df45c649cf2366abf)
This commit is contained in:
Tim Abbott 2013-03-18 17:43:16 -04:00
parent 2ce683421b
commit 02554b28cb
1 changed files with 5 additions and 0 deletions

View File

@ -264,6 +264,11 @@ class Message(models.Model):
rendered_content = bugdown.convert(self.content)
if rendered_content is None:
rendered_content = '<p>[Humbug note: Sorry, we could not understand the formatting of your message]</p>'
# Update the database cache of the rendered content
self.rendered_content = rendered_content
self.rendered_content_version = bugdown.version
self.save()
obj['content'] = rendered_content
obj['content_type'] = 'text/html'
else: