import re
from django.db import DatabaseError, transaction
+from django.utils.html import linebreaks
from quotes.models import QuoteTag, Quote, Work, Author
quote.tags.add(tag)
def paragraphize(text):
- paragraph = ""
- for line in text.splitlines():
- line = line.strip()
- if not line: continue
- paragraph += "<p>%s</p>" % line
- # rest of the HTML will be bleach.clean()'d
- return paragraph
+ text = text.strip()
+ return linebreaks(text)
def create_quote(quotetext, authorname, workname, tagline, resultcontext):
author = get_or_create_author(authorname, resultcontext)