Reputation: 189
I have a blog model. I have text field where I want to write in HTML, for example including an a
tag. The permission class used on unsafe methods is isAdminUser
. I don't necessarily have to escape the characters. Is there way where I could not escape the characters.
Upvotes: 0
Views: 1002
Reputation: 189
This bit of code helped. I basically had to override to_representation.
def to_representation(self, instance):
ret = super().to_representation(instance)
ret['text'] = html.unescape(ret['text'])
return ret
Upvotes: 1