2
To provide the initial data for the field use the initial
parameter:
form = MyForm(instance=my_obj, initial={'custom_field': 'Test'})
Or, if you want to do it in the __init__
constructor:
def __init__(self, *args, **kwargs):
kwargs['initial'] = kwargs.get('initial', {})
kwargs['initial']['custom_field'] = 'Test'
super(MyForm, self).__init__(*args, **kwargs)
Source:stackexchange.com