'DecimalField' object has no attribute 'get_internal_type'

condi = ExpressionWrapper(F(‘unit_price’)*0.8, output_field=DecimalField())

dicounted_price = Product.objects.annotate(


return render(request, 'hello.html', {'Name': 'Hengly', 'dicounted_price': list(dicounted_price)})

#Djanog – The Ultimate Django Series: Part 1
–18- Working with Expression Wrappers

anyone can help please I have tried it for 2day

You imported the wrong DecimalField class.
What you imported is django.forms.DecimalField
What you need to import is django.db.models.DecimalField
VScode’s auto import can be your best friend and worst enemy at the same time. Lol

Happy coding;)


Thx BFX0.9, I have done it with your recommendation. Now it work


I’m glad I could help :wink:

1 Like

Thank you some much.

VS Code import django.forms.DecimalField by itself which is wrong. We need to Import django.db.models.DecimalField which is the right import to resolve > ‘get_internal_type’ issue.