Felix Ingram wrote:
> 3. Binding data - I'd like the form to handle editing of an instance.
> I could construct a dictionary of values and pass it to the form as
> per the docs but I'd like to just pass a model instance and have the
> form sort things out. Is this advisable? If so then does anyone have
> any pointers about what methods I need to implement?

You can use the model instances __dict__:

my_form = CreateForm(initial=model_instance.__dict__)

Saves copying each field into a seperate dict or implementing any extra
methods in your form.

Chris


--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to