Skip to content Skip to sidebar Skip to footer

Missing Required Charfield In Django Is Saved As Empty String And Do Not Raise An Error

If I try to save incomplete model instance in Django 1.10, I would expect Django to raise an error. It does not seem to be the case. models.py: from django.db import models class

Solution 1:

Use this,

from django.db import models

class Essai(models.Model):
    ch1 = models.CharField(max_length=100)
    ch2 = models.CharField(max_length=100)

Post a Comment for "Missing Required Charfield In Django Is Saved As Empty String And Do Not Raise An Error"