whats the recommended way of modifying/adding the fields in a djangoform object i was trying adding a new key to the dictionary obj.base_fields['new_field']='value_of_newfield
' but as it turns out that it will be added as a string and not a CharField
,that can be worked around but some where down my gut i have this feeling that its not the recommended way ..and i am not talking about obj(intial={'new_field':'value_of_newfield'})
Asked
Active
Viewed 45 times
0

Bunny Rabbit
- 8,213
- 16
- 66
- 106
1 Answers
0
You must add an instance of a form field:
from django import forms
obj.base_fields['name_of_field'] = forms.CharField()

Bernhard Vallant
- 49,468
- 20
- 120
- 148