According to django's documentation, "The max_length is enforced at the database level and in Django's validation.". Can you verify that the max_length is configured in you database structure?
On May 4, 11:46 am, MS <fretka1...@gmail.com> wrote: > Hi, > > I have a problem with django+postgresql: > I have a model with a CharField(max_length=255) field, and I'm > assigning some much longer value to this field, like: > > m = MyModel() > m.myfield = 'very long text - say 400 chars' > m.save() > > In save() I'm getting an error "ERROR: value too long for type > character varying(255)", and the SQL statement contains the 'very long > text - say 400 chars' intact. > > I thought that if django knows that a field is restricted to 255 > chars, then it will validate it and > truncate excessive chars before saving. But it doesn't. How can I get > rid of that problem? > > Thanks, > MS --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---