I'm facing an issue with rendering a Unicode blank symbol in my Django project after upgrading to Python 3.11 and Django 4.1.7. Previously, I was using the following code snippet in my MyForm
class:
from django import forms
class MyForm(forms.ModelForm):
class Meta:
model = mymodel
labels = {
"test": "​",
}
The purpose of using "" was to maintain formatting due to its equivalent height as a normal character.
However, since updating to Python 3.11 and Django 4.1.7, the Unicode blank symbol is no longer displayed correctly. Instead, it's being shown as the string "".
I'd appreciate any insights into how I can resolve this issue. Thank you i```n advance for your help.
Best regards, tux
the solution is very easy, just use real python unicode coding instead of the html unicode. The reason why it crashed was, that Django is rendering the & to &. So the is a ​ and the browser writes this sting:
here my solution which works:
from django import forms
class MyForm(forms.ModelForm):
class Meta:
model = mymodel
labels = {
"test": "\u200B",
}