How can I order fields in Django ModelForm?
Posted
by joozek
on Stack Overflow
See other posts from Stack Overflow
or by joozek
Published on 2010-05-23T21:11:19Z
Indexed on
2010/05/27
22:11 UTC
Read the original article
Hit count: 216
django-forms
|ordering
I have an 'order' Model:
class Order(models.Model):
date_time=models.DateTimeField()
# other stuff
And I'm using Django ModelForm class to render a form, but I want to display date and time widgets separately. I've came up with this:
class Form(forms.ModelForm):
class Meta:
model = Order
exclude = ('date_time',)
date = forms.DateField()
time = forms.TimeField()
The problem is that I want to put these fields somewhere between 'other stuff'
© Stack Overflow or respective owner