I'm writing a little wizard application to walk a user through
creating a bunch of Model objects. I stumbled across something kind
of interesting; if I create a ModelForm like so:
SomeModelForm(initial={...})
All of the fields I have are prepopulated, except the ForeignKey ones.
I don't have many-to-many, so can't say if the problem is there too.
Now, if I create one with:
SomeModelForm(instance=some_instance)
All fields are prepopulated correctly, including the ForeignKey
variety. To me, this is not desirable because I have a component that
now has to check if it has a ModelForm or not. Ideally I could pass a
{} with foreign key values and have drop-downs preselected with the
corresponding options.
Thinking about it a little more, couldn't this interface simply be:
ModelForm(initial=X)
where X is either a dict or a Model instance? Seems like this would
be consistent with the Form init (but Form would only work with {})
while adding what's needed for ModelForm.
Any thoughts?
Thanks,
Dave
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---