[Answered ]-How to save data as null in database in Django forms

1πŸ‘

βœ…

to do so you have to make the field that you need to be optional nullable, for example if you want to make the email optional you would edit the field in the model like this:

email = models.EmailField(blank=True, null=True) 

and also in the form needs to be not required like this:

email = forms.EmailField(required=False)  

so based on your requirements you need to edit the declaration of subject in your model to like this:

subject = models.CharField(max_length=255,blank=True)
πŸ‘€tareq albeesh

Leave a comment