maraujop/django-crispy-forms — pull request #46 by rmutter (2012-05-07 02:20:33+00:00)
Title: Fix for ChoiceFields using non-string choices with radio buttons

When using a ModelChoiceField with the RadioSelect widget I found that if I instantiate a form with request data, then display that form on the screen, a previously selected radio button will no longer be "checked".

This is due to choice.0 in radioselect.html being equal to the pk of the model, while field.value is the string representation of that pk. Essentially it is checking 1 == "1" and resolving to false when it should be true.