Set initial value to modelform in class based generic views
You should define a get_initial
method which returns a dictionary that contains the initial values:
class IncidentUpdateView(UpdateView): def get_initial(self): return { 'value1': 'foo', 'value2': 'bar' }
Alternatively, you can define an initial
value:
class IncidentUpdateView(UpdateView): initial = { 'value1': 'foo', 'value2': 'bar' }