django - Print long integers in python -
If I run it then vote .created_on is a python datetime:
import calendar Created_on_timestamp = calendar.timegm (vote.created_on.timetuple ()) * 1000 created_on_timestamp = str (created_on_timestamp) created_on_temstamp will be tampered with tampering ('). If I do int () or something like this, then I get something like 1240832864000L which is not a number in relation to Javascript (where I have to use these figures).
Does anyone know the best way to handle this situation? Should I strip for long periods of string and strip tick marks? It seems crazy
=== Edited Appendix ===
The big problem was that Django "HTML was being converted to encoded equivalent and 39; (or similar). The best way to change the long time in a string and when the template purges the string, use {{created_on_timestamp | safe}} to present quotation marks as quotation marks.
gt;> i = 1240832864000L>> 1240832864000L>> gt; & gt; & Gt; W Rint come 1240832864000 & gt; & gt;; & Gt; & gt; & gt; '& lt; script type = "text / javascript" & gt; var name =% s; & lt; / script & gt;' % I '& lt; script type = "text / javascript"> number number = 1240832864000; When you trigger the object, Only visible
When you send this data to Javascript and if you send it as a JSON, then you should not be worried about long litrations or how the Python should have its object in Python Displays in.
Comments
Post a Comment