Linebreak zephyrs.

(imported from commit c77499b17ce195e36169bcb39a5f5bdfe6a3ce51)
This commit is contained in:
Luke Faraone 2012-12-10 15:39:28 -05:00
parent 6cff3dc735
commit b9b7d1b8f1
1 changed files with 4 additions and 1 deletions

View File

@ -398,6 +398,9 @@ def bulk_create_clients(client_list):
existing_clients.add(name)
batch_bulk_create(Client, clients_to_create)
def linebreak(string):
return string.replace('\n\n', '<p/>').replace('\n', '<br/>')
class Message(models.Model):
sender = models.ForeignKey(UserProfile)
recipient = models.ForeignKey(Recipient)
@ -454,7 +457,7 @@ class Message(models.Model):
if apply_markdown:
# obj['content'] = bugdown.convert(self.content)
obj['content'] = escape(self.content)
obj['content'] = linebreak(escape(self.content))
obj['content_type'] = 'text/html'
else:
obj['content'] = self.content