On Wed, Aug 20, 2008 at 9:10 AM, patrickk <[EMAIL PROTECTED]> wrote:
>
> my upload form looks like this:
>
> class UploadForm(forms.Form):
>
>    def __init__(self, path_server, path, *args, **kwargs):
>        self.path_server = path_server
>        self.path = path
>        super(UploadForm, self).__init__(*args, **kwargs)
>
>    file = forms.FileField(label="File")
>    use_image_generator = forms.BooleanField()
>
>    def clean_file(self):
>        ...
>
> now, I´d like to use UploadFormSet = formset_factory(UploadForm,
> extra=5).
> question is: where do I set path_server & path?

You must subclass django.forms.formsets.BaseFormSet and override
_construct_form to pass in your parameters. Then you can pass your
FormSet subclass as the base of the FormSet returned by
formset_factory like so: formset_factory(UploadForm,
formset=BaseUploadFormSet, extra=5).

-- 
Brian Rosner
http://oebfare.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to