Home > OS >  How to write a character in python html
How to write a character in python html

Time:04-12

I want "V" in html page when I add value in database

<td>{{stud.MaxVolt}}</td>

one way is I write V with database's value but I want it to be written automatically

CodePudding user response:

You append it at after the template variable, so:

<td>{{ stud.MaxVolt }}V</td>

or with a non-breaking space [wiki] in between:

<td>{{ stud.MaxVolt }}&nbsp;V</td>

this will normally prevent that V is put on another line, so it will not split between 42 and V in 42 V.

one way is I write V with database's value.

I would really advise not to use a CharField for numerical data, but a DecimalField [Django-doc] or FloatField [Django-doc] for data with a decimal dot, or IntegerField [Django-doc] for integral data.

CodePudding user response:

Please just do {{stud.MaxVolt}}V Thanks

CodePudding user response:

Please just do {{stud.MaxVolt}}V . The V will be in the template not in database anymore .

Thanks

  • Related