On 5/12/2009 11:32 AM, Luke Graybill wrote: > I didn't mean to imply a feature suggestion, I meant to ask if this is > possible already. If not, then is there some way to manipulate the form > __init__ (through _meta.fields perhaps?) to accomplish an approximation > of what I want? > > I'm just looking for a best-practice solution here - am I out of luck on > this, or can I get some ideas on how better to handle things?
I'm not clear on how you would: 1. Avoid knowing what fields are served up by a given mixin. 2. Avoid explicitly referring to those fields to affect the order other than the default. Since you want "automatic" ordering, I'm assuming you're just throwing {{ form }} on your template, right? As far as I know, there's no hook into a Form object to directly manipulate the field order. I think your options are: 1. Manipulate the order of `form.fields` upon `__init__`. 2. Subclass `forms.Form` and override `_html_output` however you want. 3. Write a custom form rendering method on your form class or superclass. 4. You can couple #3 with a form factory that accepts something like `ModelAdmin.fields` so you can be dynamic about the field order without having to create additional form classes. I think the ModelAdmin form factory pattern is a pretty good one to follow. -- George --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---