django - How to permanetly fix a mysql error: Data truncated for column with an alter table statement? -
i have field
logo=models.imagefield(upload_to="restaurant_detail/restaurant_detail", help_text = "upload restaurant logo")
this returns error,data truncated column 'logo' @ row 1
so go ahead fix statement
alter table my_table modify logo varchar(500)
(i increase characters.)
this works everytime reset database have again and when try , execute alter statement above , insert data, still fails data truncated column 'logo' @ row 1
error.
how permanently fix without having alter table time?
change field definition to:
logo = models.imagefield(max_length=500, upload_to="restaurant_detail/restaurant_detail", help_text="upload restaurant logo")
i added max_length kwarg tells django how many chars field can store , cause database field created appropriately.
Comments
Post a Comment