I have a problem with django formset. I want to validate one field in the formset. I followed these links Django Passing Custom Form Parameters to Formset
and able to create the forms.
but how can i POST my data to formset.
this is my form
class BookingDetailsForm(forms.Form):
age = forms.IntegerField()
def __init__(self, trip, *args, **kwargs):
super(BookingDetailsForm, self).__init__(*args, **kwargs)
age = self.fields["age"]
trip = trip
print "This prints when formset is created"
def clean_age(self):
// want some checking here
#raise ValidationError('Error msg')
return self.cleaned_data['age']
and my view is
formset = formset_factory(BookingDetailsForm, extra=number_of_peoples)
formset.form = staticmethod(curry(BookingDetailsForm, trip))
// above two line is working perfectly
Then How can I POST My formset??
formset = formset_factory(BookingDetailsForm, trip, request.POST)// not working
and after posting i want to check age field in clean method.