#5986: Custom field order in newforms
------------------------------------------------+---------------------------
Reporter: emes | Owner: nobody
Status: new | Component:
django.newforms
Version: SVN | Resolution:
Keywords: field order weight form newforms | Stage:
Unreviewed
Has_patch: 0 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
------------------------------------------------+---------------------------
Comment (by emes):
So, here it goes, with Form.Meta.fields_order list.
Example:
{{{
from django import newforms as forms
class UserForm(forms.Form):
# Used for registering new accounts.
username = forms.CharField(max_length=20)
email = forms.EmailField()
password = forms.CharField(max_length=20)
password2 = forms.CharField(max_length=20)
# Lots of validators which check if username is unique,
# password1 == password2 and so on.
class UserProfileForm(UserForm):
# Inherits all UserForm fields and validators and adds
# optional profile entries.
first_name = forms.CharField(max_length=30)
last_name = forms.CharField(max_length=30)
jabber_id = forms.EmailField()
class Meta:
fields_order = ['username', 'first_name', 'last_name',
'email', 'jabber_id', 'password']
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/5986#comment:2>
Django Code <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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---