﻿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
35843	Changing the rendering order of formsets is not clear	Matthew Pava	Clifford Gama	"I have a formset that I'd like to modify the order of the forms in. I did overwrite the `forms` `cached_property` with a simple sorted addition to the base `forms` `cached_property`, but I soon discovered that data wasn't saving properly in some cases.

Apparently, I went about it all wrong. There's this little tiny tidbit here about rendering forms:
[https://docs.djangoproject.com/en/5.1/topics/forms/formsets/#:~:text=Iterating%20over%20a%20formset%20will,which%20returns%20the%20corresponding%20form]

{{{
Iterating over a formset will render the forms in the order they were created. You can change this order by providing an alternate implementation for the __iter__() method.

Formsets can also be indexed into, which returns the corresponding form. If you override __iter__, you will need to also override __getitem__ to have matching behavior.
}}}

Okay, but I've never implemented an `__iter__` method, and based on what I've read, you also have to implement a `__next__` method. And you explicitly tell me to implement the `__getitem__` method. I understand if you don't want to make changing the rendering ordering easier to implement in Django; however, I would appreciate more and better documentation including an example of how exactly to implement any of these methods to change the rendering order of a formset."	Cleanup/optimization	closed	Forms	5.1	Normal	fixed			Ready for checkin	1	0	0	0	0	0
