From a Django project using SQLite, create an app:
$ python3 manage.py startapp case
Add the following contents to 'case/models.py':
from django.db import models
class A(models.Model):
b = models.CharField(max_length=10)
def __str__(self):
return self.b
Then, after adding the app to INSTALLED_APPS setting, sync the database:
$ python3 manage.py syncdb
Then run:
$ python3 manage.py shell
>>> from case.models import A
>>> a = A(b='x'*20)
>>> a.save()
>>> A.objects.all()[0]
<A: xxxxxxxxxxxxxxxxxxxx>
If you could reproduce, the 20 characters string was allowed on a
CharField with max_length=10. This caused me problems because I user
SQLite on development, and PostgreSQL on production, and because of this
issue, I missed a bug during development only to see it in production.
--
Ticket URL: <https://code.djangoproject.com/ticket/21471>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_docs: => 0
* resolution: => invalid
* needs_tests: => 0
* needs_better_patch: => 0
Comment:
Yes, this is a limitation of SQLite. see http://www.sqlite.org/faq.html#q9
This is why it's recommended to use the same database for development as
you use in production.
--
Ticket URL: <https://code.djangoproject.com/ticket/21471#comment:1>