# Form return None Value

**URL:** <https://forum.djangoproject.com/t/form-return-none-value/9658>\
**Category:** Using Django\
**Created:** [September 10, 2021, 5:13pm UTC](https://forum.djangoproject.com/t/form-return-none-value/9658 "2021-09-10T17:13:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thais781](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/thais781/32/4775_2.png) [@thais781](https://forum.djangoproject.com/u/thais781)\
**Post date:** [September 10, 2021, 5:13pm UTC](https://forum.djangoproject.com/t/form-return-none-value/9658/1 "2021-09-10T17:13:30Z")

</div>

Hi Guys,

When a user fill out a form, sometime, he do not put an information.  
So, the field is empty.

The result in Django (Reuest.POST Form) is a None value.  
Is there a way to change this None value to an empty value : '"" ?

In models ? in forms ?in views ??

Thanks for your help

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [September 10, 2021, 5:59pm UTC](https://forum.djangoproject.com/t/form-return-none-value/9658/2 "2021-09-10T17:59:21Z")

</div>

Hi thais781,

If you’re using a form class this should be done automatically for you if it’s a [`CharField` as per these docs](https://docs.djangoproject.com/en/3.2/ref/forms/fields/#required).

Can you share the form and view for this? And can you determine if the field is being included in the POST? You can find that in the browser’s development tools’ network panel.

---

<div class="post-metadata">

**Author:** ![thais781](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/thais781/32/4775_2.png) [@thais781](https://forum.djangoproject.com/u/thais781)\
**Post date:** [September 11, 2021, 6:59am UTC](https://forum.djangoproject.com/t/form-return-none-value/9658/3 "2021-09-11T06:59:35Z")

</div>

Hi Tim

Thanks for your help  
you mean I just have to add ‘required=False’ to my models ?  
but i hav this error : TypeError: **init** () got an unexpected keyword argument ‘required’

I give you a simplify version(one field for easy reading) of my structure :

```auto
models.py
class Peoples_Main(models.Model):
   name_last = models.CharField(max_length = 100, blank=True, null=True)

forms.py
class Peoples_Etat_Civil_Form(ModelForm):
	class Meta:
		model = Peoples_Main
		fields = ['name_last']

views.py
my_peoples_etat_civil_form = Peoples_Etat_Civil_Form(instance=my_people_main)

if request.method == 'POST':
	my_temp = Peoples_Etat_Civil_Form(request.POST,instance=my_people_main)
	if my_temp.is_valid(): my_temp.save()

template.html
<div class="input-group py-1">
{% render_field my_peoples_etat_civil_form.name_last class="form-control" placeholder="[-- Nom --]" %}
</div>

```

Sorry, I am a french girl so somme word in my code are in french

---

<div class="post-metadata">

**Author:** ![CodenameTim](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/codenametim/32/31507_2.png) [@CodenameTim](https://forum.djangoproject.com/u/CodenameTim)\
**Post date:** [September 11, 2021, 3:06pm UTC](https://forum.djangoproject.com/t/form-return-none-value/9658/4 "2021-09-11T15:06:45Z")

</div>

> [@thais781](#):
>
> Sorry, I am a french girl so somme word in my code are in french

No worries! I shouldn’t have to understand those variables/members to help you.

So what I think is happening is that passing the instance is what is causing the value to be retained as `None` rather than be converted to `""`. If you’re trying to default to an empty string, is there a reason why you want that field to support NULLs in the database?

---

<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:** [September 11, 2021, 3:17pm UTC](https://forum.djangoproject.com/t/form-return-none-value/9658/5 "2021-09-11T15:17:29Z")

</div>

Also, in addition to @CodenameTim 's question about the NULLs, can we see the complete view? (My question involves how “my\_people\_main” is being created or accessed?)
