How do I assign initial values to fields inside a ModelForm? eg:
class Form1(forms.Form):
title=forms.CharField(initial=\"hello\")
What wil
Model Form defaults are taken from the model itself. For example:
class SomeModel(models.Model):
title = models.CharField(max_length=45, default="hello")
You don't need to make any changes to your ModelForm:
class RequestForm(forms.ModelForm):
class Meta:
model = SomeModel
Normally you would pass the model object you are editing as instance keyword arg to the form:
Form2(instance = somemodelobject)
, but I don't know if it works on GAE.
You can always pass initial dictionary to your form's constructor, like
Form2(initial = {"title": "blahblah"})