﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12404	Improve max_length validation	Tim Valenta	josh	"Absentmindedly I wrote a line like the following in a model, where I accidentally contracted the definition of max_length and help_text into a single keyword arg:

{{{
    field = models.CharField(max_length=""This field is really cool. Not to mention this message."")
}}}

My accidental value for max_length is not being validated to check and see if it is indeed an integer for use in a MySQL varchar field definition.  The SQL created during {{{ ./manage.py syncdb }}} is as follows, which causes the error also following:

{{{
    `field` varchar(This field is really cool. Not to mention this message.) NOT NULL
}}}
{{{
    _mysql_exceptions.ProgrammingError: (1064, ""You have an error in your SQL syntax;
    check the manual that corresponds to your MySQL server version for the right
    syntax to use near 'This field is really cool. Not to mention this message.) NOT NULL\n)'
    at line 4"")
}}}

Improved validation might simply try casting the value of max_length to an integer before proceeding."		closed	Database layer (models, ORM)	dev		fixed	max_length, validation	Leo Shklovskii	Ready for checkin	1	0	0	0	0	0
