On Wed, May 14, 2008 at 6:14 PM, Chris <[EMAIL PROTECTED]> wrote:

>
> Hello I created a new forms form and I am having uses with this
> statement:
>
>    year_of_birth = forms.ChoiceField(required=False,
> choices=YEAR_OF_BIRTH)
>
> and tuple looks like so:
>    year_of_birth = ((1990, '1990'), (1989, '1989'), ...)
>
> On my local dev server, I have latest django and use sqllite, this
> works fine but when I push code to our company dev server and try to
> run code it, it breaks and give me the following message. On the
> company dev we use mysql. This almost looks like it could be a mysql
> specific bug but the error is so vague who knows. I don't understand
> how I can pass a tuple through and it think that I am giving it a ''
> value.
>
> Exception Type:         Warning
> Exception Value:        Incorrect integer value: '' for column
> 'year_of_birth' at row 1
> Exception Location:     /usr/lib/python2.5/site-packages/MySQLdb/
> cursors.py in _warning_check, line 80
>
> Could someone please help. This error is driving me crazy!
>
> Thanks in advance.
>

You don't mention when you get this error: all of the time, regardless of
the choice, only when the 'blank' choice is chosen, etc?  MySQL is
complaining that it is being handed and empty string to put in an integer
field.  I notice you have required=False on the form field, so I'd guess you
are seeing this only when the 'blank' choice is chosen, in which case I
suspect the fix would be to specify null=True in the model field, so that
blank will be stored as null in the database.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to