Use Django's six module for StringIO imports.

This commit is contained in:
Will Stott 2016-11-17 11:25:46 +00:00
parent 07f7489e2c
commit f34696df8d
2 changed files with 2 additions and 5 deletions

View File

@ -8,10 +8,7 @@ forms.py - Definitions of newforms-based forms for creating and maintaining
"""
from django.core.exceptions import ObjectDoesNotExist
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from django.utils.six import StringIO
from django import forms
from django.forms import extras

View File

@ -1388,7 +1388,7 @@ class CustomField(models.Model):
)
def _choices_as_array(self):
from StringIO import StringIO
from django.utils.six import StringIO
valuebuffer = StringIO(self.list_values)
choices = [[item.strip(), item.strip()] for item in valuebuffer.readlines()]
valuebuffer.close()