On Apr 9, 2:55 am, codecowboy <guy.ja...@gmail.com> wrote: > I want to create a form that allows a user to edit his/her profile. I > don't want to bind my form to a model because the form will involve > two different models. Does anyone have any ideas. I've read chapter > 7 in the Django Book but it only to a simple example that does not > help me. > > Here is what I have tried. > > s = get_object_or_404(Scientist, pk=7) > form = ScientistProfileForm(initial=s) > > I've also tried. > > form = ScientistProfileForm(s) > > I always get the following error message. > > Caught an exception while rendering: 'Scientist' object has no > attribute 'get' > > Thanks in advance for any help. If I figure this out then I will post > my solution in here in great detail for anyone else that needs it.
If it's not a ModelForm, you can't just pass in an instance. You'll need a dictionary. initial_dict = { 'name': s.name, ... etc ... } form = ScientistProfileForm(initial=initial_dict) -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---