python - Django store csv float items in database -


i have csv file data like:

company,104.95,102.8,102.6,104.5,104.5,102.75...\n etc.

i storing float values prices[1:len(prices)] in

models.commaseparatedintegerfield(blank=true, null=true, max_length=10000)

but after values stored, float values quotes '104.95','102.8','102.6','104.5','104.5','102.75'

whereas want store values floats, not strings. how achieve that?

you can convert them floats so:

float_prices = [float(p) p in prices[1:len(prices)]] 

that said, commaseparatedintegerfield validate comma-separated list of integers. neither strings nor floats valid field - it's odd able save data posted.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -