Question

I am using django-tinymce v1.5.1b2.

I am also using an HTMLField() model field like this:

class Page(models.Model):
    title = models.CharField(max_length=512)
    slug = models.SlugField(max_length=512, default='', blank=True)
    content = tinymce_models.HTMLField(blank=True)

Everything works fine.

However I noticed that when I save the page, I get this in the content field in my MySQL database

<p>&Alpha;&pi;ό &tau;&alpha; &chi;&rho;ό&nu;&iota;&alpha; &tau;&omicron;&upsilon; &Iota;&pi;&pi;&omicron;&kappa;&rho;ά&tau;&eta;...

Why is that? I know that MySQL supports utf data. Can I change tinymce's behaviour to store normal utf characters and not html codes?

It is important for me, because I intent to create a new tag that would parse the content to find certain words and add some extra HTML just before displaying it to the user.

Was it helpful?

Solution

I found the solution. I am posting it here for anyone having the same problem, to see.

I just added this line in my TINYMCE_DEFAULT_CONFIG dictionary in setting.py

TINYMCE_DEFAULT_CONFIG = {
            'entity_encoding': 'raw', 
        }

OTHER TIPS

I think you can use the {{"the value you will display with tiny_mce in html"|safe}},then I think the problem will slove You can also see here: Why does TinyMCE in Django admin output HTML tags?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top