class country(models.Model):
name = models.CharField(max_length=80)
code = models.CharField(max_length=3)
The code field has a maximum length of 3, but through the shell, the
length seems to be exceeded without throwing a validation error. But from
the Django Admin portal, the character length appears to work as expected.
I've taken screenshots to show the existence of the bug.
--
Ticket URL: <https://code.djangoproject.com/ticket/34403>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "Screen Shot 2023-03-10 at 2.12.48 PM.png" added.
The screenshot displays how the max_length is exceeded, but a validation
error is not raised.
* status: new => closed
* resolution: => duplicate
Comment:
`Model.save()` doesn't call model validation, see #34061.
--
Ticket URL: <https://code.djangoproject.com/ticket/34403#comment:1>
Comment (by Ittach1):
It is the same behaviour for .create (..)
--
Ticket URL: <https://code.djangoproject.com/ticket/34403#comment:2>
Comment (by Mariusz Felisiak):
Replying to [comment:2 Ittach1]:
> It is the same behaviour for .create (..)
Yes, you have to call `full_clean()` manually.
--
Ticket URL: <https://code.djangoproject.com/ticket/34403#comment:3>