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 6146,newsforms.widget.Select does not accept long int as choices,Tim ,nobody,"While using newforms form_for_instance or form_for_model, I was trying to override the form: {{{ MyModelAddForm = form_for_model(MyModel) MyModelAddForm.base_fields['field_one'].widget = forms.Select(choices=[(testa.id, testa.name) for testa in Test.objects.all()]) MyModelAddForm.base_fields['field_two'].widget = forms.CheckboxSelectMultiple(choices=[(testb.id, testb.name) for testb in Test.objects.all()]) }}} However, I was getting the error that there are ""too many values to unpack"". After a little debugging I found that MySQL is returning ""1L"", ""2L"", etc. as the id/pk. This is recognized in the tests [http://code.djangoproject.com/browser/django/trunk/tests/modeltests/field_defaults/models.py] as MySQL behavior. However, for new forms the Select field seems to be looking for an Integer only. By adding int() around the returning id/pk field, the problem was fixed. {{{ MyModelAddForm = form_for_model(MyModel) MyModelAddForm.base_fields['field_one'].widget = forms.Select(choices=[(int(testa.id), testa.name) for testa in Test.objects.all()]) MyModelAddForm.base_fields['field_two'].widget = forms.CheckboxSelectMultiple(choices=[(int(testb.id), testb.name) for testb in Test.objects.all()]) }}} I believe that Long Integers from MySQL shouldn't have the trailing L.",,closed,Forms,dev,,invalid,choices mysql,,Unreviewed,0,0,0,0,0,0