On Tue, Jul 8, 2008 at 10:00 AM, Milan Andric <[EMAIL PROTECTED]> wrote: > On Mon, Jul 7, 2008 at 6:22 AM, d-rave <[EMAIL PROTECTED]> wrote: >> >> Has anyone successfully got formtools.preview working with >> forms.ModelForm so that the form fields are populated from the model. >> >> If so, do you have an example?? > > Dave, I'm not familiar with formtools but if all you want to do is > prepopulate a form then you can use the initial={} keyword arg. This > probably doesn't help but ... you could do this in your view if you > want: > > form = Form(initial={'user':u, ...}) > > http://www.djangoproject.com/documentation/newforms/#dynamic-initial-values >
Another trick is to use model_to_dict to pass in initial values : from django.newforms.models import model_to_dict ... f = Form( initial=model_to_dict(obj) ) -- Milan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---