Gary,
after some testing I came to this solution:
I created my own form_for_instance function like this:
def form_for_instance(instance):
f = forms.models.form_for_instance(instance=instance, form=MyCustomForm)
f.base_fields['email'].initial=instance.email
...
f.base_fields['senha'].initial=instance.senha
return f()
So... if I need a form for an instance it uses the
forms.models.form_for_instance using MyCustomForm, then I create an instance
of this form and set the initials in the fields.
I know it's not smart, but it works..
On 4/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> >From what I remember you do:
>
> def myformcallback(f, **args):
> exclude = ['author']
> if f.name in exclude:
> return None
> return f.formfield(**args)
>
> MyForm = form_for_instance(book, formfield_callback=myformcallback)
>
> if request.POST:
> form = MyForm(request.POST)
> form.save()
> else:
> form = MyForm()
>
> I found it much easier to just bite the bullet and pretend
> form_for_model and form_for_instance don't exist. It's more work
> initially, but it's clear.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---