X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=influences%2Fmodels.py;h=78daa15992304ee33882f4da9922ee38a930f3c7;hb=51d871cc825c454a819fb6f73b6d0840679efaac;hp=198b0318aa77e63f614618bc50025bad94d46156;hpb=ffe8bfb47649a438d1485179e68abfb5e0e17a48;p=matthijs%2Fprojects%2Fxerxes.git diff --git a/influences/models.py b/influences/models.py index 198b031..78daa15 100644 --- a/influences/models.py +++ b/influences/models.py @@ -1,8 +1,10 @@ from django.db import models from django.core.urlresolvers import reverse from django.contrib.auth.models import User +from django.utils.text import normalize_newlines from django.utils.translation import ugettext_lazy as _ from threadedcomments.models import ThreadedComment +from xerxes.tools.text import rewrap # Create your models here. class Character(models.Model): @@ -60,7 +62,9 @@ class Influence(models.Model): If private is True, private comments are included in this list. """ def quote_reply(comment): - return "\n".join(["> " + l for l in comment.comment.split("\n")]) + regex = "^([ >]*)(.*)$" + text = rewrap(normalize_newlines(comment.comment), 72, regex) + return "\n".join(["> " + l for l in text.split("\n")]) # Import here to prevent dependency loop, since forms depends on # models as well