[Answer]-Modelform prepopulate foreign key

1👍

You should probably not set it in init method. If you have to do it, then set it in save() method.

def save(self, force_insert=False, force_update=False, commit=True):
    m = super(InputForm, self).save(commit=False)
    m.column = calc_column(column_parameter)
    if commit:
        m.save()
    return m

But in case you absolutely have to set this value, then i suggest you do it with initial data:

InputForm(initial = {'column':calc_column(column_parameter)})

Leave a comment