Allow use of optgroup style of field choices

Uses field.flatchoices to select the first choice
from the field's choices, so that it works for fields
that use optgroups
Merge pull request #22 from sjhewitt/master

Fix picking the value for a field when using grouped field choices