#35325: CharField max_length ignored
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  Aristotelis Mikropoulos            |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  5.0
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 In a vanilla project and app (all default settings, nothing changed),
 trying to create a model record with a CharField longer than what is
 defined, works (no exception raised, no truncation):

 {{{
 # models.py
 from django.db import models

 class Foo(models.Model):
     name = models.CharField(max_length=5)
 }}}

 {{{
 $ python manage.py shell
 >>> from foo.models import Foo
 >>> Foo.objects.create(name='abcdefghijk')
 <Foo: Foo object (1)>
 >>> f = Foo.objects.first()
 >>> f
 <Foo: Foo object (1)>
 >>> f.name
 'abcdefghijk'
 }}}

 Maybe I am missing something, or maybe that's just sqlite behavior, but
 shouldn't some exception be raised?

 Ubuntu 22.04
 Python 3.10.12
 Django 5.0.3
 DB engine django.db.backends.sqlite3 (default)
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35325>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e661aa84b-ce2312f4-f14c-41c0-bc34-617299b9e789-000000%40eu-central-1.amazonses.com.

Reply via email to