When you have redefined ModelAdmin and redefined ModelForm for change_view/add_view, this form will be modified to AdminForm. In process, django will automatically create fieldset, if it's not already there, by calling get_fieldset (django.contrib.admin.options.py:425):
def get_fieldsets(self, request, obj=None):
"Hook for specifying fieldsets for the add form."
if self.declared_fieldsets:
return self.declared_fieldsets
form = self.get_form(request, obj)
fields = list(form.base_fields) + list(self.get_readonly_fields(request, obj))
return [(None, {'fields': fields})]
Obviously, this won't preserve any ordering that may have been specified in self.fields.keyOrder. I understand why this was implemented in such a way: keyOrder is specified (in most cases) when form is initialized, and AdminForm is created before that, but it would be great to have ordering functionality in place for django-admin, so i propose to think about the good way to fix this.