All pastes #590921 Raw Edit

Something

public text v1 · immutable
#590921 ·published 2007-06-26 21:15 UTC
rendered paste body
>>> AddressForm = forms.form_for_model(amt.Address)
>>> class AddressUpdateForm(AddressForm):
...   whattodo = forms.ChoiceField(choices=CHOICES_LIST)
...
>>> f = AddressUpdateForm()
>>> dir(f)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__getitem__', '__hash__', '__init__', '__iter__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__unicode__', '__weakref__', '_errors', '_get_errors', '_html_output', '_model', 'add_prefix', 'as_p', 'as_table', 'as_ul', 'auto_id', 'base_fields', 'clean', 'data', 'errors', 'fields', 'full_clean', 'initial', 'is_bound', 'is_valid', 'non_field_errors', 'prefix', 'save', 'whattodo']
>>> f.whattodo
<django.newforms.fields.ChoiceField object at 0xb73ecfac>
>>> f.fields.keys()
['person', 'contact_type', 'name', 'line1', 'line2', 'city', 'state', 'zip', 'country', 'invalid', 'merged_from']
>>> # WTF? Why isn't whattodo in f.fields.keys() when it's clearly a defined field?