On Mon, 2007-12-17 at 05:13 -0800, Vitaliy wrote:
> How can I change fields order in form generated using
ModelForm ?
I think you're approach the problem from the wrong angle.
ModelForm is a
shortcut for converting a model directly to a form. If you
want to alter
a lot of things, such as the order, then you're going to be
writing the
names of all the fields anyway. So write your own little
helper function
to construct a form from your models' fields. Base it on the
code for
ModelForm or something similar, but just write something
specialised.
I'd normally say something like "have a look at how
newforms-admin does
this", but, in this case, that would make things worse
because the Admin
interface needs to be able to handle all kinds of weird
cases, so its
form construction is fairly involved.
Regards,
Malcolm
--
Two wrongs are only the beginning.
http://www.pointy-s
tick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-users googlegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|