Here is the model field:
prices = ArrayField(models.DecimalField(max_digits=6, decimal_places=2), null=True)...
Values:
prices': [[Decimal('23.00'), Decimal('38.50')], [Decimal('11.06')], [Decimal('20.00')], [Decimal('3.95')], [Decimal('11.00')], [Decimal('1.77'), Decimal('31.34')], [Decimal('6.62'), Decimal('19.00')], [Decimal('20.60')].....]
My aim is to insert into the Postgres DB thusly:
models.DasModel.objects.create(
somedate = date,
myprices = prices,..)
I understand Postgres cannot accept such lists into an ArrayField but they must be of the form {val1, val2,...}
The error I am getting is
DETAIL: "[" must introduce explicitly-specified array dimensions.
Is there an quick and easy way to do the conversion?
尝试使用-
prices = ArrayField(ArrayField(models.DecimalField(max_digits=6, decimal_places=2)), null=True)...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.