Hi Django Users,

                  I had done the custom form with some fields which 
includes(charfield,foreignkey(ModelChoiceField),many_to_many 
field(MultiplemodelChoiceField) ),I had created a formset for my form then i 
need to process and pass the formset datas into my template

*this is my form:*

*class JobPostingForm(forms.Form):*
            name = forms.CharField(max_length=250)
           city = forms.ModelChoiceField(queryset=City.objects.all())
          tag = forms.ModelMultipleChoiceField(queryset=Tag.objects.all())

(Formset)
MJobFormSet=formset_factory(JobPostingForm, max_num=5, extra=2)

*view function* 

*def view_post_multiple_jobs(request,post_mjobs_template):*
           if request.method == 'POST':
                         mjob_form_set = MJobFormSet(request.POST)
                         if mjob_form_set .is_valid():
                                    form_set_data = 
mjob_form_set.cleaned_data
                     
                         def _save_job(job):
                                 name=job['name']
                                  *city=______*
                                  *tag=______*
                                  mjob=Job.objects.create(name=name,*
city=city,tags=tag*)
                            return mjob
                    map(_save_job, [job for job in form_set_data if job]

  return (template)

Here I don't know that how to process the city,tag objects in _save_job() 
because city is foreign key object and tag is many_tomany object retirned 
from formset

could you please point it even i have tried in times

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