forms - Display a pound / currency symbol in a Django select input -
I have many currency values in the form selection box (i.e. and £ 2,500
). When the form is provided, although it is and pounds;
, is there any way to convert it into an actual pound sign?
If I correctly understand your question, then the problem is that & amp; ; Pound;
Automatically escapes the form library and hence & amp; Pound;
not as a user and in the form of pounds;
You can probably solve the problem by telling the DEGENGO that the HTML code is safe and it should not be saved (maybe a XSS security hole):
from django .utils.safestring import mark_safe option = (mark_safe ('& amp; pound; 2,500'), ...)
Alternatively you can type directly into characters using escape sequences (Those entities are not part of the current HTML specifications, you can still use Unicode ):
# - * - Coding: UTF-8 - * - Option = (U '£ 2,500', ...)
Comment Wise h encoding will be the first line of the existing file, let the interpreter know that you are using Unicode encoding in the source file.
Comments
Post a Comment