Skip to content

Cherry pick the 1.9 upgrades #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions django_remote_forms/fields.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

from django.conf import settings
from django.utils.datastructures import SortedDict
from collections import OrderedDict

from django_remote_forms import logger, widgets

Expand All @@ -24,7 +24,7 @@ def __init__(self, field, form_initial_data=None, field_name=None):
self.form_initial_data = form_initial_data

def as_dict(self):
field_dict = SortedDict()
field_dict = OrderedDict()
field_dict['title'] = self.field.__class__.__name__
field_dict['required'] = self.field.required
field_dict['label'] = self.field.label
Expand Down
10 changes: 7 additions & 3 deletions django_remote_forms/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.utils.datastructures import SortedDict
from collections import OrderedDict
from django import forms

from django_remote_forms import fields, logger
from django_remote_forms.utils import resolve_promise
Expand Down Expand Up @@ -99,13 +100,16 @@ def as_dict(self):
}
}
"""
form_dict = SortedDict()
form_dict = OrderedDict()
if isinstance(self.form, forms.formsets.BaseFormSet):
form_dict = self.get_formset_dict(self.form)
return form_dict
form_dict['title'] = self.form.__class__.__name__
form_dict['non_field_errors'] = self.form.non_field_errors()
form_dict['label_suffix'] = self.form.label_suffix
form_dict['is_bound'] = self.form.is_bound
form_dict['prefix'] = self.form.prefix
form_dict['fields'] = SortedDict()
form_dict['fields'] = OrderedDict()
form_dict['errors'] = self.form.errors
form_dict['fieldsets'] = getattr(self.form, 'fieldsets', [])

Expand Down
8 changes: 4 additions & 4 deletions django_remote_forms/widgets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

from django.utils.dates import MONTHS
from django.utils.datastructures import SortedDict
from collections import OrderedDict


class RemoteWidget(object):
Expand All @@ -10,7 +10,7 @@ def __init__(self, widget, field_name=None):
self.widget = widget

def as_dict(self):
widget_dict = SortedDict()
widget_dict = OrderedDict()
widget_dict['title'] = self.widget.__class__.__name__
widget_dict['is_hidden'] = self.widget.is_hidden
widget_dict['needs_multipart_form'] = self.widget.needs_multipart_form
Expand Down Expand Up @@ -197,7 +197,7 @@ def as_dict(self):

class RemoteRadioInput(RemoteWidget):
def as_dict(self):
widget_dict = SortedDict()
widget_dict = OrderedDict()
widget_dict['title'] = self.widget.__class__.__name__
widget_dict['name'] = self.widget.name
widget_dict['value'] = self.widget.value
Expand All @@ -212,7 +212,7 @@ def as_dict(self):

class RemoteRadioFieldRenderer(RemoteWidget):
def as_dict(self):
widget_dict = SortedDict()
widget_dict = OrderedDict()
widget_dict['title'] = self.widget.__class__.__name__
widget_dict['name'] = self.widget.name
widget_dict['value'] = self.widget.value
Expand Down