Hi all,

              just i want to pass the request object to my form for
doing some dynamic operation even i am using formset

This is my form:

class PostJobForm(forms.ModelForm):
    """ Post Job Form """
    def __init__(self, *args, **kwargs):
        request = kwargs.pop('request')
        super(PostJobForm, self).__init__(*args, **kwargs)
        site_tags = identify_site_tags(request)
        tags = map(lambda x:Tag.objects.get(name=x),
site_tags)         ##my dynamic operation for 'tags' fields
        self.fields["tags"].queryset = tags
    class Meta:
        model = Job
        fields=('code', \
                'name', \
                'description', \
                'company', \
                'url',\
                'tags', \
                'state',\
                'city', \
                'postedby'\

                )

    description = forms.CharField(widget=widgets.\
                                  TinyMCE(attrs={'cols':80, 'rows':
20}))

from django.utils.functional import curry
PostMutipleJobFormSet = formset_factory(PostJobForm,max_num=10,
extra=5)
PostMutipleJobFormSet.form.append(staticmethod(curry(PostJobForm,request=request)))
##/here is my doubt  IS IT correct?


I am passing in my view like this:::

post_mJob_formset =
PostMutipleJobFormSet(request=request,request.POST)     ##Passing
request object



Here what i want is i have to successfully filter the 'tags' model to
display in this form,for that it needs request object.
identify_site_tags...,etc some are the module which i am using for my
own purpose

could you please suggest the problem here?

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