Рамка чтения Django возвращает значение десятичных полей после округления или усечения.Как это можно предотвратить?
Моя модель Django
class Stock(models.Model):
name = models.CharField(max_length=255)
code = models.CharField(max_length=20, db_index=True)
price = models.DecimalField(max_digits=19, decimal_places=2)
diff = models.DecimalField(max_digits=19, decimal_places=5)
open_price = models.DecimalField(max_digits=19, decimal_places=2)
previous_close = models.DecimalField(max_digits=19, decimal_places=2)
low52 = models.DecimalField(max_digits=19, decimal_places=2)
high52 = models.DecimalField(max_digits=19, decimal_places=2)
last_updated = models.DateTimeField()
objects = DataFrameManager()
def save(self, *args, **kwargs):
''' On save, update timestamps '''
self.last_updated = timezone.now()
return super(Stock, self).save(*args, **kwargs)
def __str__(self):
return str(self.code)
введите описание изображения здесь
Но когда я читаю данные с использованием django readframe, тогда ясм
In [41]: read_frame(Stock.objects.filter(code='ABB'))
Out[41]:
id name code price diff open_price previous_close low52 high52 last_updated
0 1 ABB India Ltd. ABB 1400.00 5.02 1328.60 1325.45 1190.00 1670.00 2019-09-20 14:51:28.666744+00:00