emmett-framework / emmett

The web framework for inventors
BSD 3-Clause "New" or "Revised" License
1.06k stars 71 forks source link

Sort fields in form [improvement] #147

Open josejachuf opened 8 years ago

josejachuf commented 8 years ago

You can sort the fields in the form based on model. Currently orders fields defined with Field() , but always located at the end of the fields defined with belongs_to().

Jose

gi0baro commented 8 years ago

@josejachuf how should I sort them? The fields in the model would have the same order of the instances, because the ones generated by the belongs_to helper will be added to the ones defined in the class, after the class is defined.

josejachuf commented 8 years ago

@gi0baro perhaps explicitly, using a new form-helper [1].

[1] http://weppy.org/docs/0.7/dal/models#forms-helpers

josejachuf commented 8 years ago

@gi0baro Provisionally for a particular case I solved this way (is rather ugly)

form.fields.insert(4, form.fields.pop())

Jose