# Default Null with Integer field showing 0 in UI edit mode

**URL:** <https://forum.djangoproject.com/t/default-null-with-integer-field-showing-0-in-ui-edit-mode/31095>\
**Category:** Mystery Errors\
**Created:** [May 12, 2024, 7:08pm UTC](https://forum.djangoproject.com/t/default-null-with-integer-field-showing-0-in-ui-edit-mode/31095 "2024-05-12T19:08:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANBU1305](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/anbu1305/32/21246_2.png) [@ANBU1305](https://forum.djangoproject.com/u/ANBU1305)\
**Post date:** [May 12, 2024, 7:08pm UTC](https://forum.djangoproject.com/t/default-null-with-integer-field-showing-0-in-ui-edit-mode/31095/1 "2024-05-12T19:08:14Z")

</div>

Hey There,  
I have issue while editing the form info where while fetching the Integer field value it is returning as None from ORM and this is the sample field I am facing the issue

sample\_int = models.IntegerField(null = True)

sample ORM

test = Test.objects.get(pk = pk)  
(test.sample\_int) #### None

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 12, 2024, 7:33pm UTC](https://forum.djangoproject.com/t/default-null-with-integer-field-showing-0-in-ui-edit-mode/31095/2 "2024-05-12T19:33:44Z")

</div>

Welcome @ANBU1305 !

I’m sorry, I’m not understanding what you’re saying here. Can you be a little more clear about what the issue is?

What specifically isn’t working as you expect? What are you seeing that you’re not expecting to see? (Or, what aren’t you seeing that you expect to see?)

Side note: When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted. (If you’re just posting one line, you can surround the code between single backticks.)

---

<div class="post-metadata">

**Author:** ![ANBU1305](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/anbu1305/32/21246_2.png) [@ANBU1305](https://forum.djangoproject.com/u/ANBU1305)\
**Post date:** [May 14, 2024, 9:43am UTC](https://forum.djangoproject.com/t/default-null-with-integer-field-showing-0-in-ui-edit-mode/31095/3 "2024-05-14T09:43:56Z")

</div>

@KenWhitesell I am facing a scenario where I need to render an Integer Field in HTML. The issue arises when I save the form data without providing any value for the Integer Field. In PostgreSQL, it is then saved as `Null` . However, when attempting to edit the form in Django, the Integer Field returns as `None` . Consequently, when trying to bind the HTML data, it displays as `None` . Below is the code snippet for better understanding

this is the models Field

`industry = models.IntegerField(null = True)`

this is my html code

````auto
                            <label for="exampleInputEmail1">
                                Industry<span id="required-label"></span>
                            </label>
                            <input type="text"
                                   class="form-control"
                                   id="industry"
                                   name="industry"
                                   value="{{ lead.industry }}"
                                   aria-describedby=""
                                   placeholder="Enter Industry" />
                            <div class="invalid-feedback"></div>
                        </div>```

Excepted flow this value Industry should return empty Value , but it is returning None 

what will be the best solution for this issue
````
