Skip to content
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

Added compatibility with Python 3 & Django 1.10+ #40

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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ Installation

The recommended way to install from source is with pip:

// Original repository only for Python 2 versions
pip install -e "git+https://github.com/theatlantic/django-chosen.git#egg=django-chosen"

// This repository compatible with Python 3
pip install git+https://github.com/Jeanluis019/django-chosen
If the source is already checked out, use setuptools:

python setup.py develop
Expand Down
2 changes: 1 addition & 1 deletion chosen/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django import forms

from widgets import ChosenSelect, ChosenSelectMultiple, ChosenGroupSelect
from chosen.widgets import ChosenSelect, ChosenSelectMultiple, ChosenGroupSelect

__all__ = [
'ChosenFieldMixin', 'ChosenChoiceField', 'ChosenMultipleChoiceField',
Expand Down
6 changes: 2 additions & 4 deletions chosen/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# flake8: noqa
import fields
from fields import *
from chosen.fields import *

import widgets
from widgets import *
from chosen.widgets import *
6 changes: 3 additions & 3 deletions chosen/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def render(self, *args, **kwargs):
def add_to_css_class(self, classes, new_class):
new_classes = classes
try:
classes_test = u" " + unicode(classes) + u" "
new_class_test = u" " + unicode(new_class) + u" "
classes_test = u" " + str(classes) + u" "
new_class_test = u" " + str(new_class) + u" "
if new_class_test not in classes_test:
new_classes += u" " + unicode(new_class)
new_classes += u" " + str(new_class)
except TypeError:
pass
return new_classes
Expand Down