Can anyone point me in the right direction regarding customer validation of forms via an inlineformset_factory? I want to make sure at least one form is completed and that no two forms have the same date.
(I have to admit, I'm getting confused by how all the different classes relate to each other) I tried this below, but it doesn't even look as if it is getting triggered when I'm debugging. >>>>>>>>>>>>>> '''Source : http://stackoverflow.com/questions/877723/inline-form-validation-in-django/1884760#1884760''' class BaseAppointmentFormset(BaseInlineFormSet): def is_valid(self): return super(BaseAppointmentFormset, self).is_valid() and not any([bool(e) for e in self.errors]) def clean(self): # get forms that actually have valid data count = 0 for form in self.forms: try: if form.cleaned_data and not form.cleaned_data.get('DELETE', False): count += 1 except AttributeError: # annoyingly, if a subform is invalid Django explicity raises # an AttributeError for cleaned_data pass if count < 1: raise forms.ValidationError('You must have at least one order') AppointmentFormFactory = inlineformset_factory(Event, Appointment, extra=7, max_num=7, can_delete=True, form=AppointmentForm, formset=BaseAppointmentFormset) formset = AppointmentFormFactory(instance=current_event) >>>>>>>>>>>>>>>>>>>> -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

