#5986: Custom field order in newforms
---------------------------------------------+------------------------------
          Reporter:  emes                    |         Owner:  nobody           
               
            Status:  new                     |     Milestone:  post-1.0         
               
         Component:  Forms                   |       Version:  SVN              
               
        Resolution:                          |      Keywords:  field order 
weight form newforms
             Stage:  Design decision needed  |     Has_patch:  1                
               
        Needs_docs:  1                       |   Needs_tests:  0                
               
Needs_better_patch:  0                       |  
---------------------------------------------+------------------------------
Comment (by GertSteyn):

 After reeding CookBookNewFormsFieldOrdering this came to mind...

 class FooForm(forms.ModelForm):
     class Meta:
         fields  = ('first_field', 'second_field', 'third_field',)

     def __init__(self, *args, **kwargs):
         super(FooForm, self).__init__(*args, **kwargs)
         self.fields.keyOrder = self.Meta.fields

 The patch has now been reduced to a one liner:
 "self.fields.keyOrder = self.Meta.fields"

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5986#comment:17>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to