Re: data too long in a CharField column

2020-08-21 Thread hans alexander
I changed my database from mysql to postgresql. But when I tried saving data on forms, I got this error " value too long for type character varying(50)" I don't know why, because when I was using MYSQL, I didn't get any error. Can someone help me with this Postgresql? On Monday, May 4, 2009 at 10

Re: data too long in a CharField column

2009-05-05 Thread MS
Hi, On 5 Maj, 14:02, parkprimus wrote: > 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? Yes, I have it. AFAIK max_length is required in CharFiel

Re: data too long in a CharField column

2009-05-05 Thread parkprimus
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 wrote: > Hi, > > I have a problem with django+postgresql: > I have a model with

Re: data too long in a CharField column

2009-05-04 Thread Malcolm Tredinnick
On Mon, 2009-05-04 at 08:46 -0700, MS 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() >

Re: data too long in a CharField column

2009-05-04 Thread pbzRPA
Hi, I am not sure if truncating the data is a good solution as the user will be under the impression that all the text was saved whereas only the first 255 was really saved. You can add a max_length to your form or modelform field which will block the user from typing more then the max length.

Re: data too long in a CharField column

2009-05-04 Thread MS
> > If you want that behavior, just truncate `myfield` in `MyModel.save()` > before calling the super save. > > Well, if that's THE solution, then I'll post my implementation - maybe someone will find it useful: def au

Re: data too long in a CharField column

2009-05-04 Thread George Song
On 5/4/2009 8:46 AM, MS wrote: > 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