OK, thanks. I was on the verge of rolling my own solution anyway.

Form models won't work for me; although the ID I want to pass is a primary
key to a table, I need to rummage around in the database and track down
several bits and pieces; there's not a simple correspondence to one
particular model in this case, sadly. At least I don't think so; I may give
it another look.


Wayne Smith-4 wrote:
> 
> On Aug 19, 1:58 pm, SixDegrees <paulcarli...@comcast.net> wrote:
>> I'm no longer at the computer where my code resides. But "you are wanting
>> to
>> call formset_factory
>> and have it pass along a parameter to the Form that the formset
>> contains" is pretty much what I want to know how to do.
> 
> Well, the short answer is that you can't do that--formset_factory()
> does not accept kwargs.
> 
> Your other option is to basically write your own formset_factory().
> If you look at the source, you will see that it really doesn't do
> anything special--it's more of a convenience method that creates a
> basic FormSet.  You could also write your own Formset, with its own
> custom __init__ method, inherit from BaseFormSet, and pass that to the
> formset_factory() method.  Yeah, that's probably what I would do.
> 
> A good rule of thumb that I have found is that if you are trying to do
> something with Django, and it is either not possible or requires a
> good bit of hackery, then you are probably (although not always)
> "doing it wrong".  Most of Django is very flexible, but sometimes you
> just need to know where to look for the answer.  That's why I was
> inquiring about exactly what your code is doing and such--your use of
> a primary key makes me think (but doesn't guarantee) that you are
> using a form to represent an instance of a model, and if so, you want
> to be looking there.
> 
> Wayne
> 
> -- 
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Dynamic-Forms-with-Varying-init-Arguments-tp32296362p32298409.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to