I have a model named Article like this:
class Article(models.Model):
title = models.CharField(max_length=50)
content = models.TextField()
note = models.TextField(blank=True)
when I test it use the following code:
# create the article
article = Article()
# set the attributes
article.title = 'x'*60
article.content = 'Good Morning, Sir'
article.note = ''
# save it
article.save()
The length of title is bigger than max_length=50, but the test passed.Why?
Aucun commentaire:
Enregistrer un commentaire