These are chat archives for django/django

Jun 2018
Manish Thakur
Jun 08 2018 11:17

Hello Everyone, I am trying to learn Django and I am stuck with one issue:
I have two models with a decimal field

total = models.DecimalField(default=0.00, max_digits=5, decimal_places=2)


price = models.DecimalField(decimal_places=2, max_digits=5, default=1.00)

I am trying to add these two values in my view function

my_total =

but I am getting this error

Type Error unsupported operand type(s) for +: 'float' and 'decimal.Decimal'
Jun 08 2018 11:27
@manishth Put import pdb; pdb.set_trace() to the line
At least you have to cast Decial to float first before proceed addition
Manish Thakur
Jun 08 2018 12:11
@elcolie thanks :) but shouldn't they be of the same type as both are declared a DecimalField in the model?
Jun 08 2018 13:15
Hi everyone. I am looking for a drag and drop editors, like Elementor in Wordpress. Is there any elementor type page builder in Django ?
Jun 08 2018 14:59
@Neerajkashyap you'r using some django based cms?
Jun 08 2018 15:35
@manishth I have no idea. Since I work with money I use django-money