id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 21592,formset.ordered_forms should try to return ordered forms if is_valid() is false,nickname123,,"I am not sure if this should be a bug report or a feature request. I think that formset.ordered_forms should be usable even if the formset is invalid. This is particularly useful in conjunction with Form Wizard for me, but I think there are plenty of other cases where this would be nice. See https://github.com/django/django/blob/stable/1.6.x/django/forms/formsets.py#L216 where is_valid() == False causes an AttributeError It would be useful for rendering templates. The particular data I am working is much easier to understand if it is displayed in order. I was attempting to allow ordering the forms without moving to the next step in a form wizard. So I overrode the formset is_valid method like below with the intentions that the user could post ordering without moving to the next step: {{{ class BaseOrderFormSet(BaseFormSet): """""" THIS FORMSET RETURNS INVALID IF THE USER SUBMITTED A REQUEST TO ADD ADDITIONAL FORMS OR UPDATE THE FORMSET INSTEAD OF ACTUALLY SUBMITTING THE DATA FOR SAVING """""" can_add_form = True can_update_formset = True def is_valid(self): # do not validate if we need to add another row return not ADD_FORM_KEY in self.data and not UPDATE_FORMSET_KEY in self.data and super(BaseOrderFormSet, self).is_valid() }}} (note FunkyBob's first comment seems out of context because we were having a conversation in django-users first but it wasn't relevant enough to the ticket to copy over and it spanned a lot of other comments) {{{ [18:57] Why does the ordered_forms property of a formset required is_valid() to be True? https://github.com/django/django/blob/stable/1.6.x/django/forms/formsets.py#L216 [18:58] isn't that a fundamental of the FormWizard ? you can't progress until each 'form' is valid? [18:59] FunkyBob: I am trying to allow users to order the forms in the formset but I cannot output them using ordered_forms until the formset is valid [18:59] I don't understand why is_valid is important for outputting the forms in an ordered fashion [19:00] I see [19:01] My use case is the following: I have added ""add another"" function like the admin. Then I have added an ""update"" button that rerenders the template. I was hoping to easily allow ordering without javascript [19:02] Which I can still do... that is just how I ran into this [19:04] Well by still can do I mean I can do it if I reimplement the ordered_forms property. Didn't know if there was a specific reason this was only allowed for valid forms [19:04] Or if maybe I should submit a bug/feature request [19:05] <+bmispelon> gp: fwiw, the full test suite still passes if self.is_valid() is removed [19:08] Ty. I will submit a ticket and override it for my formset }}}",New feature,closed,Forms,dev,Normal,duplicate,,,Accepted,1,0,0,1,0,0