Change python3 compatibility

This commit is contained in:
Tomas 2019-09-24 13:16:34 +02:00
parent 3ab2dd9d38
commit 27851b8eb5
2 changed files with 18 additions and 2 deletions

View file

@ -60,6 +60,20 @@ matrix:
env: DJANGO_VERSION='Django>=1.9,<1.10'
- python: "3.6"
env: DJANGO_VERSION='Django>=1.10,<1.11'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.4,<1.5'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.5,<1.6'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.6,<1.7'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.7,<1.8'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.8,<1.9'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.9,<1.10'
- python: "3.7"
env: DJANGO_VERSION='Django>=1.10,<1.11'
install:
- pip install -q $DJANGO_VERSION

View file

@ -20,7 +20,6 @@ from django import VERSION
from django.db import models
from django.utils.text import capfirst
from django.utils.encoding import python_2_unicode_compatible
from django.core import exceptions
from ..forms.fields import MultiSelectFormField, MinChoicesValidator, MaxChoicesValidator
@ -47,7 +46,6 @@ def add_metaclass(metaclass):
return wrapper
@python_2_unicode_compatible
class MSFList(list):
def __init__(self, choices, *args, **kwargs):
@ -58,6 +56,10 @@ class MSFList(list):
msg_list = [msgl.choices.get(int(i)) if i.isdigit() else msgl.choices.get(i) for i in msgl]
return u', '.join([string_type(s) for s in msg_list])
if sys.version_info < (3,):
def __unicode__(self, msgl):
return self.__str__(msgl)
class MultiSelectField(models.CharField):
""" Choice values can not contain commas. """