I'd like to pre-populate one of the data elements of the extra_form of
a formset factory with a string, and it's not clear to me how to do
this from the documentation, since formset_factory does not take
initial as an argument.

Here's an example:

class FavoriteSearch(models.Model):
   search    = models.CharField(max_length=128)
   user  = models.ForeignKey(Employee)

from django.forms.models import inlineformset_factory
SomeFormset =inlineformset_factory(User, FavoriteSearch, extra=1)
...
formset = SomeFormset(instance=some_user)

Having done this, I can access the extra form with this:
formset.extra_forms[0]

And I can access the BoundField in the widget created for the search
field like this:
formset.extra_forms[0]['search']

But how can I populate that with some initial data for the user?

Thanks for your help!

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

Reply via email to