On Jan 6, 2008 11:27 AM, shabda <[EMAIL PROTECTED]> wrote: > > But I need the initial data to be dynamic, so I can't just do > text = forms.CharField(widget = forms.Textarea, initial = 'sometext') > > I assume I can do some thing along the lines of overriding __init__ > for this form, passing the requored value from the view function and > then using something like > text = forms.CharField(widget = forms.Textarea, initial = > self.page.text) > I just can't get this to work? Any place where I can look for dynamic > values to initial? > Not exactly what you're looking for, but in the neighborhood:
http://code.djangoproject.com/wiki/CookBookNewFormsDynamicFields You want to do something like def __init__(...): ... self.fields['text'].initial = function_to_get_my_initial_value() HTH, Todd --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---