forms.py changed data problem.

Using the html editor in Django’s forms.py always results in has_changed() = True.

I am using tinymce editor.

example

form django.forms import forms
from tinymce.widget import TinyMce

ex = '<p>asdf</p><p>\n</p><p>asdf</p>'
class a(forms.Form):
a = forms.Textarea(widget=TinyMce)

def clean_a(self):
 retrun ex
def __init__(self, **kwargs):
 super().__init__(initial={'a': ex})

If you use this example code, then calling changed_data always includes the a field.
The reason is that the bound field data of a is as follows.

print(f"{self['a']="})
"self['a']=<p>asdf</p><p>\r\n</p><p>asdf</p>"

It may be unclear what the difference is, but you can see that the text \n to \r\n has been added.

Ironically, although initial and cleaned_data match, it is recognized as a changed field because the data value of the bound field is different.

The process of confirming that data has been changed in the form appears to inherit multiple codes.

In the middle, self[name] is called, and after checking it, I found out that it was a boundfield.

I wanna know.
How to change bound data or,
About how bound data is converted to HTML
or other solution.

If you create the field as a custom field subclass, you can edit the field in the to_python method of that field. This would allow you to alter the contents of the field coming in, before it is compared with the existing data. (For example, you could strip all the ‘linefeed’ characters from the incoming data.)

See Form and field validation | Django documentation | Django for details.