# Path: django_core/forms/widgets.py
# class ChoiceAndCharInputWidget(ExtendedMultiWidget):
#     """Renders choice field and char field next to each other."""
# 
#     def __init__(self, choices=None, attrs=None, widgets=None,
#                  widget_css_class='choice-and-char-widget', **kwargs):
# 
#         if not attrs:
#             attrs = {}
# 
#         if not widgets:
#             widgets = (
#                 Select(choices=choices),
#                 TextInput()
#             )
# 
#         super(ChoiceAndCharInputWidget, self).__init__(
#             widgets=widgets,
#             attrs=attrs,
#             widget_css_class=widget_css_class,
#             **kwargs
#         )
# 
#     def decompress(self, value):
#         if value:
#             return value
# 
#         return [None, None]
# 
# Path: django_core/forms/widgets.py
# class MultipleDecimalInputWidget(ExtendedMultiWidget):
#     """Renders an input with 4 decimal fields."""
# 
#     def __init__(self, attrs=None, widgets=None, num_inputs=4, value_suffix='',
#                  widget_css_class='horizontal-widget multi-decimal-widget',
#                  **kwargs):
#         self.num_inputs = num_inputs
#         self.value_suffix = value_suffix
# 
#         if not attrs:
#             attrs = {}
# 
#         self.get_widget_css_class(attrs)
# 
#         if widgets is None:
#             widgets = tuple([NumberInput() for w in range(num_inputs)])
# 
#         super(MultipleDecimalInputWidget, self).__init__(
#             widgets=widgets,
#             attrs=attrs,
#             widget_css_class=widget_css_class,
#             **kwargs
#         )
# 
#     def decompress(self, value):
#         if value and self.value_suffix and isinstance(value, string_types):
#             value = value.replace(self.value_suffix, '')
# 
#         if value:
#             return value.split(' ')
# 
#         return [None for i in range(self.num_inputs)]
# 
#     def get_widget_css_class(self, attrs):
#         """Gets the class for the widget."""
#         size_class = 'size-{0}'.format(self.num_inputs)
# 
#         if 'class' in attrs:
#             attrs['class'] += ' {0}'.format(size_class)
#         else:
#             attrs['class'] = size_class


from copy import deepcopy
from django.core.exceptions import ValidationError
from django.forms.fields import CharField
from django.forms.fields import ChoiceField
from django.forms.fields import DecimalField
from django.forms.fields import MultiValueField
from django.utils.translation import ugettext as _
from django_core.forms.widgets import ChoiceAndCharInputWidget
from .widgets import MultipleDecimalInputWidget
        if not data_list:
            return None

        values = deepcopy(data_list)

        for index, value in enumerate(values):
            if value and float(value).is_integer():
                value = int(value)

            if value:
                values[index] = '{0}{1}'.format(value, self.value_suffix)
            else:
                values[index] = '0'

        return ' '.join(values)

    def to_python(self, value):
        """Validates that the input can be converted to a list of decimals."""
        if not value:
            return None

        if isinstance(value, list):
            for index, position_val in enumerate(value):
                val = super(MultipleDecimalField, self).to_python(position_val)
                value[index] = val

        return value


class ChoiceAndCharField(MultiValueField):

# Path: django_core/forms/widgets.py
# class ChoiceAndCharInputWidget(ExtendedMultiWidget):
#     """Renders choice field and char field next to each other."""
# 
#     def __init__(self, choices=None, attrs=None, widgets=None,
#                  widget_css_class='choice-and-char-widget', **kwargs):
# 
#         if not attrs:
#             attrs = {}
# 
#         if not widgets:
#             widgets = (
#                 Select(choices=choices),
#                 TextInput()
#             )
# 
#         super(ChoiceAndCharInputWidget, self).__init__(
#             widgets=widgets,
#             attrs=attrs,
#             widget_css_class=widget_css_class,
#             **kwargs
#         )
# 
#     def decompress(self, value):
#         if value:
#             return value
# 
#         return [None, None]
# 
# Path: django_core/forms/widgets.py
# class MultipleDecimalInputWidget(ExtendedMultiWidget):
#     """Renders an input with 4 decimal fields."""
# 
#     def __init__(self, attrs=None, widgets=None, num_inputs=4, value_suffix='',
#                  widget_css_class='horizontal-widget multi-decimal-widget',
#                  **kwargs):
#         self.num_inputs = num_inputs
#         self.value_suffix = value_suffix
# 
#         if not attrs:
#             attrs = {}
# 
#         self.get_widget_css_class(attrs)
# 
#         if widgets is None:
#             widgets = tuple([NumberInput() for w in range(num_inputs)])
# 
#         super(MultipleDecimalInputWidget, self).__init__(
#             widgets=widgets,
#             attrs=attrs,
#             widget_css_class=widget_css_class,
#             **kwargs
#         )
# 
#     def decompress(self, value):
#         if value and self.value_suffix and isinstance(value, string_types):
#             value = value.replace(self.value_suffix, '')
# 
#         if value:
#             return value.split(' ')
# 
#         return [None for i in range(self.num_inputs)]
# 
#     def get_widget_css_class(self, attrs):
#         """Gets the class for the widget."""
#         size_class = 'size-{0}'.format(self.num_inputs)
# 
#         if 'class' in attrs:
#             attrs['class'] += ' {0}'.format(size_class)
#         else:
#             attrs['class'] = size_class


# Path: django_core/forms/fields.py
from copy import deepcopy
from django.core.exceptions import ValidationError
from django.forms.fields import CharField
from django.forms.fields import ChoiceField
from django.forms.fields import DecimalField
from django.forms.fields import MultiValueField
from django.utils.translation import ugettext as _
from django_core.forms.widgets import ChoiceAndCharInputWidget
from .widgets import MultipleDecimalInputWidget

        if not data_list:
            return None

        values = deepcopy(data_list)

        for index, value in enumerate(values):
            if value and float(value).is_integer():
                value = int(value)

            if value:
                values[index] = '{0}{1}'.format(value, self.value_suffix)
            else:
                values[index] = '0'

        return ' '.join(values)

    def to_python(self, value):
        """Validates that the input can be converted to a list of decimals."""
        if not value:
            return None

        if isinstance(value, list):
            for index, position_val in enumerate(value):
                val = super(MultipleDecimalField, self).to_python(position_val)
                value[index] = val

        return value


class ChoiceAndCharField(MultiValueField):

    widget = ChoiceAndCharInputWidget