Default Null with Integer field showing 0 in UI edit mode

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

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

@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

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

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

what will be the best solution for this issue