I've noticed that a foriegn key value in data posted to a view method is still a string after a call to do_html2python. However, it's returned as an int (what I would expect) from flatten_data().
Is this a bug or is this intended behavior? It's causing a bug in my template code where I compare the foriegn key value in the form data passed to the template to the key value in a list of objects that can be selected from (i.e. display the current set value as selected. For example, here payee is the ForiegnKey: <select name="payee"> <option value="">--select--</option> {% for payee in payee_list %} <option value="{{ payee.id }}"{% if form.data %}{% ifequal form.data.payee_id payee.id %}selected{% endifequal %}{% endif %}>{{ payee.org_company }}, {{ payee.org_city }}</option> {% endfor %} </select> {% ifequal form.data.payee_id payee.id %} fails when reloading on error since payee_id is a string and payee.id is an int. However, this works if the view is loading for the first time, since payee_id comes from flatten_data() and is an int. To my mind, the string should be converted to an int by the do_html2python() method of the FormField. I've look at the django core code, and it appears that ForiegnKey classes default to the FormField do_html2python method, which just returns the data as is (i.e. a string). Chris