I've just attached a new patch which (hopefully) makes everything work
in an acceptable way:

1. The argument ordering is still fixed, and you'll still want to pass
"instance" as a kwarg in most cases.
2. A ModelForm with neither model nor instance is an error.
3. A ModelForm which works on any of a group of models which share a
common subset of fields works.

The latter case is the one that seemed to cause some reservation on
Joseph's part, so I've added documentation for it. The way it ends up
working is actually pretty simple; for example, if an app has both a
'Writer' and an 'Editor' model, each with a field called "name", the
following ModelForm subclass can edit the name of an instance of
either one, or create a new instance with name pre-filled (assuming
you fill in any other required fields in code outside the form):

class WriterOrEditorForm(forms.ModelForm):
    name = forms.CharField(max_length=50)

The updated tests include this example and verify that it works, and
that "name" is the only field which ends up on the final form
instance.

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to