summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Liuti <liuti.john@gmail.com>2014-05-25 13:39:43 (GMT)
committerJonathan Liuti <liuti.john@gmail.com>2014-05-25 13:39:43 (GMT)
commit65c9934936f1e59c6c344428dfd1a189043af999 (patch)
tree0e1b431b688f0e97ac72fb113b41cc959f17b682
parentf20f1aa810802c89db346916db57db339fdf92e3 (diff)
downloaddjangocms-text-ckeditor-65c9934936f1e59c6c344428dfd1a189043af999.zip
djangocms-text-ckeditor-65c9934936f1e59c6c344428dfd1a189043af999.tar.gz
djangocms-text-ckeditor-65c9934936f1e59c6c344428dfd1a189043af999.tar.bz2
Fix #129, force_unicode on body to make sure it's not a proxy object anymore
-rw-r--r--djangocms_text_ckeditor/models.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/djangocms_text_ckeditor/models.py b/djangocms_text_ckeditor/models.py
index 60bbc54..be7777c 100644
--- a/djangocms_text_ckeditor/models.py
+++ b/djangocms_text_ckeditor/models.py
@@ -1,12 +1,16 @@
import re
+import sys
+
+from django.utils.encoding import force_unicode
from django.db import models
-from cms.models import CMSPlugin
from django.utils.html import strip_tags
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
-import sys
-from djangocms_text_ckeditor.utils import plugin_tags_to_id_list, replace_plugin_tags, plugin_to_tag
-from djangocms_text_ckeditor.html import clean_html, extract_images
+
+from cms.models import CMSPlugin
+
+from .utils import plugin_tags_to_id_list, replace_plugin_tags, plugin_to_tag
+from .html import clean_html, extract_images
class AbstractText(CMSPlugin):
@@ -22,6 +26,10 @@ class AbstractText(CMSPlugin):
def __unicode__(self):
return Truncator(strip_tags(self.body)).words(3, truncate="...")
+ def __init__(self, *args, **kwargs):
+ super(AbstractText, self).__init__(*args, **kwargs)
+ self.body = force_unicode(self.body)
+
def save(self, *args, **kwargs):
body = self.body
body = extract_images(body, self)