Order of fieldnames in exclude= (inside ModelForm) can mess things up
|Reported by:||czartur||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I've got a ModelForm that goes like this:
class TicketForm(forms.ModelForm): text = forms.CharField(widget = forms.Textarea(), label = _("Text")) class Meta: model = Ticket exclude=( 'last_responder_account', 'last_response_created_at' 'owner', 'owner_email', 'owner_language', 'owner_name', 'responses_count', 'status', )
Where last_responder_account and owner are both ForeignKeys and last_response_created_at is DateTimeField.
Now... When i leave it as is, then in my template i see the form with fields (title, priority, department, owner, last_response_created_at and text.
Although when I change the order in exclude= to:
exclude=( 'last_responder_account', 'owner_email', 'owner_language', 'owner_name', 'responses_count', 'status', 'owner', 'last_response_created_at' )
I get only (title, priority, department and text) which is expected result.
However... When i change it again to:
exclude=( 'owner', 'last_response_created_at' 'last_responder_account', 'owner_email', 'owner_language', 'owner_name', 'responses_count', 'status', )
I get: (title, priority, department, last_responder_account, last_response_created_at, text)
(all things enclosed in parenthesis are in order)
Personally I think that ordering in exclude= shouldn't matter, but (as shown above) somehow it has some influence on form output.