# 'DecimalField' object has no attribute 'get\_internal\_type'

**URL:** <https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921>\
**Category:** Django\
**Created:** [February 25, 2022, 6:59am UTC](https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921 "2022-02-25T06:59:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hengly](https://avatars.discourse-cdn.com/v4/letter/h/7c8e57/32.png) [@Hengly](https://forum.codewithmosh.com/u/Hengly)\
**Post date:** [February 25, 2022, 6:59am UTC](https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921/1 "2022-02-25T06:59:59Z")

</div>

condi = ExpressionWrapper(F(‘unit\_price’)\*0.8, output\_field=DecimalField())

```
dicounted_price = Product.objects.annotate(

    dicount_price=condi)

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

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [February 26, 2022, 8:08am UTC](https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921/2 "2022-02-26T08:08:37Z")

</div>

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;)

---

<div class="post-metadata">

**Author:** ![Hengly](https://avatars.discourse-cdn.com/v4/letter/h/7c8e57/32.png) [@Hengly](https://forum.codewithmosh.com/u/Hengly)\
**Post date:** [February 27, 2022, 1:49pm UTC](https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921/3 "2022-02-27T13:49:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BFX0.9](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@BFX0.9](https://forum.codewithmosh.com/u/BFX0.9)\
**Post date:** [February 27, 2022, 3:49pm UTC](https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921/4 "2022-02-27T15:49:10Z")

</div>

I’m glad I could help 😉

---

<div class="post-metadata">

**Author:** ![rjayaddi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/rjayaddi/32/4020_2.png) [@rjayaddi](https://forum.codewithmosh.com/u/rjayaddi)\
**Post date:** [July 26, 2022, 12:11pm UTC](https://forum.codewithmosh.com/t/decimalfield-object-has-no-attribute-get-internal-type/10921/5 "2022-07-26T12:11:43Z")

</div>

> 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.
