Answer the question
In order to leave comments, you need to log in
How to sort fields in a form?
class OffForm(forms.ModelForm):
make = forms.CharField()
hidden_make = forms.CharField()
model = forms.CharField()
class Meta:
model = Off
exclude = ('make', 'model')
def __init__(self, *args, **kwargs):
super(OffForm, self).__init__(*args, **kwargs)
self.fields['hidden_make'].widget = forms.HiddenInput()
self.fields.keyOrder = ['title', 'category', 'make', 'model',
'description', 'hidden_make' ]
Answer the question
In order to leave comments, you need to log in
Directly in Meta:
fields = ['title', 'category', 'make', 'model', 'description', 'hidden_make']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question