this will work only for case if some_field is blank=True,null=True. in any other case it will fail at f.save(commit=False) because of invalid form data (some_field is empty and still required)
Nathaniel Whiteinge пишет: > Your best bet is probably to use ``save(commit=False)`` [1]_ to get a > Profile instance, then set the user fk and call ``save()`` again. This > is the example from the newforms docs:: > > # Create a form instance with POST data. > >>> f = AuthorForm(request.POST) > > # Create, but don't save the new author instance. > >>> new_author = f.save(commit=False) > > # Modify the author in some way. > >>> new_author.some_field = 'some_value' > > # Save the new instance. > >>> new_author.save() > > .. [1] http://www.djangoproject.com/documentation/newforms/#the-save-method > > Cheers. > - whiteinge > > > --~--~---------~--~----~------------~-------~--~----~ > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected] > 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 > -~----------~----~----~----~------~----~------~--~--- > >
signature.asc
Description: OpenPGP digital signature

