{"action":"closed","issue":{"url":"https://api.github.com/repos/maraujop/django-crispy-forms/issues/538","labels_url":"https://api.github.com/repos/maraujop/django-crispy-forms/issues/538/labels{/name}","comments_url":"https://api.github.com/repos/maraujop/django-crispy-forms/issues/538/comments","events_url":"https://api.github.com/repos/maraujop/django-crispy-forms/issues/538/events","html_url":"https://github.com/maraujop/django-crispy-forms/issues/538","id":113709294,"number":538,"title":"Field order is unpredictable without explicit layout","user":{"login":"mverleg","id":6442863,"avatar_url":"https://avatars.githubusercontent.com/u/6442863?v=3","gravatar_id":"","url":"https://api.github.com/users/mverleg","html_url":"https://github.com/mverleg","followers_url":"https://api.github.com/users/mverleg/followers","following_url":"https://api.github.com/users/mverleg/following{/other_user}","gists_url":"https://api.github.com/users/mverleg/gists{/gist_id}","starred_url":"https://api.github.com/users/mverleg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mverleg/subscriptions","organizations_url":"https://api.github.com/users/mverleg/orgs","repos_url":"https://api.github.com/users/mverleg/repos","events_url":"https://api.github.com/users/mverleg/events{/privacy}","received_events_url":"https://api.github.com/users/mverleg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-27T23:13:02Z","updated_at":"2015-10-28T10:59:16Z","closed_at":"2015-10-28T10:59:16Z","body":"When not using an explicit layout, the order of fields is unpredictable. Within a server session it's consistent but between server restarts it's pseudo-random.\r\n\r\nI can't imagine that this is the desired behaviour, especially when Form.Meta.fields is set.\r\n\r\nI think a likely reason is in `helper.py` around line 299, where it says \r\n\r\n    left_fields_to_render = fields - form.rendered_fields\r\n\r\nI understand that using sets is much more convenient than calculating the difference manually, but sets are unordered so this has downsides. You'll want something like this http://stackoverflow.com/a/6486513/723090 . Sorry for not sending a pull request."}}