# Path: select_multiple_field/codecs.py
# def decode_csv_to_list(encoded):
#     """
#     Decodes a delimiter separated string to a Python list
#     """
#     delimiter = getattr(
#         settings, 'SELECTMULTIPLEFIELD_DELIMITER', DEFAULT_DELIMITER)
#     if encoded == '':
#         return []
# 
#     decoded = sorted(set(encoded.split(delimiter)))
#     return decoded
# 
# Path: select_multiple_field/widgets.py
# class SelectMultipleField(widgets.SelectMultiple):
#     """Multiple select widget ready for jQuery multiselect.js"""
# 
#     allow_multiple_selected = True
# 
#     def render(self, name, value, attrs={}, choices=()):
#         rendered_attrs = {'class': HTML_ATTR_CLASS}
#         rendered_attrs.update(attrs)
#         if value is None:
#             value = []
# 
#         final_attrs = self.build_attrs(rendered_attrs, name=name)
#         # output = [u'<select multiple="multiple"%s>' % flatatt(final_attrs)]
#         output = [format_html('<select multiple="multiple"{0}>',
#                               flatatt(final_attrs))]
#         options = self.render_options(choices, value)
#         if options:
#             output.append(options)
# 
#         output.append('</select>')
#         return mark_safe('\n'.join(output))
# 
#     def value_from_datadict(self, data, files, name):
#         """
#         SelectMultipleField widget delegates processing of raw user data to
#         Django's SelectMultiple widget
# 
#         Returns list or None
#         """
#         return super(SelectMultipleField, self).value_from_datadict(
#             data, files, name)


from django.conf import settings
from django.core import validators
from django.forms import fields
from django.utils import six
from .codecs import decode_csv_to_list
from .widgets import SelectMultipleField
# -*- coding: utf-8 -*-
from __future__ import unicode_literals




DEFAULT_DELIMITER = ','
DEFAULT_MAX_CHOICES_ATTR = 'data-max-choices'


class SelectMultipleFormField(fields.MultipleChoiceField):


# Path: select_multiple_field/codecs.py
# def decode_csv_to_list(encoded):
#     """
#     Decodes a delimiter separated string to a Python list
#     """
#     delimiter = getattr(
#         settings, 'SELECTMULTIPLEFIELD_DELIMITER', DEFAULT_DELIMITER)
#     if encoded == '':
#         return []
# 
#     decoded = sorted(set(encoded.split(delimiter)))
#     return decoded
# 
# Path: select_multiple_field/widgets.py
# class SelectMultipleField(widgets.SelectMultiple):
#     """Multiple select widget ready for jQuery multiselect.js"""
# 
#     allow_multiple_selected = True
# 
#     def render(self, name, value, attrs={}, choices=()):
#         rendered_attrs = {'class': HTML_ATTR_CLASS}
#         rendered_attrs.update(attrs)
#         if value is None:
#             value = []
# 
#         final_attrs = self.build_attrs(rendered_attrs, name=name)
#         # output = [u'<select multiple="multiple"%s>' % flatatt(final_attrs)]
#         output = [format_html('<select multiple="multiple"{0}>',
#                               flatatt(final_attrs))]
#         options = self.render_options(choices, value)
#         if options:
#             output.append(options)
# 
#         output.append('</select>')
#         return mark_safe('\n'.join(output))
# 
#     def value_from_datadict(self, data, files, name):
#         """
#         SelectMultipleField widget delegates processing of raw user data to
#         Django's SelectMultiple widget
# 
#         Returns list or None
#         """
#         return super(SelectMultipleField, self).value_from_datadict(
#             data, files, name)


# Path: select_multiple_field/forms.py
from django.conf import settings
from django.core import validators
from django.forms import fields
from django.utils import six
from .codecs import decode_csv_to_list
from .widgets import SelectMultipleField

# -*- coding: utf-8 -*-
from __future__ import unicode_literals




DEFAULT_DELIMITER = ','
DEFAULT_MAX_CHOICES_ATTR = 'data-max-choices'


class SelectMultipleFormField(fields.MultipleChoiceField):


    widget = SelectMultipleField