mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
Fixed #3054 -- newforms Form now keeps track of field order
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4093 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -28,6 +28,9 @@ except NameError:
|
||||
class Field(object):
|
||||
widget = TextInput # Default widget to use when rendering this type of Field.
|
||||
|
||||
# Tracks each time a Field instance is created. Used to retain order.
|
||||
creation_counter = 0
|
||||
|
||||
def __init__(self, required=True, widget=None):
|
||||
self.required = required
|
||||
widget = widget or self.widget
|
||||
@@ -35,6 +38,10 @@ class Field(object):
|
||||
widget = widget()
|
||||
self.widget = widget
|
||||
|
||||
# Increase the creation counter, and save our local copy.
|
||||
self.creation_counter = Field.creation_counter
|
||||
Field.creation_counter += 1
|
||||
|
||||
def clean(self, value):
|
||||
"""
|
||||
Validates the given value and returns its "cleaned" value as an
|
||||
|
||||
Reference in New Issue
Block a user