I have a model that has a foreign key relation to another. I'd like to have the dropdown that is produced by widget=forms.Select have a default value
views:
41answers:
1
+1
A:
Maybe just create form and set field's intial value?
class SomeForm(forms.ModelForm):
class Meta:
model = SomeModel
fields = ('field')
def __init__(self, *args, **kwargs):
super(SomeForm, self).__init__(*args, **kwargs)
self.fields['field'].initial = 'inital_value'
yedpodtrzitko
2009-12-01 18:11:15