Skip to content

Commit

Permalink
Merge pull request #4 from AGASS007/master
Browse files Browse the repository at this point in the history
Compatibility Django 1.10
  • Loading branch information
fle authored Oct 28, 2016
2 parents 536a3bf + 95cc042 commit 98c5b8c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 51 deletions.
47 changes: 7 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
language: python

python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5

env:
- DJANGO_VERSION=1.4 MODULE=multi_email_field
- DJANGO_VERSION=1.5 MODULE=multi_email_field
- DJANGO_VERSION=1.6 MODULE=multi_email_field.tests
- DJANGO_VERSION=1.7 MODULE=multi_email_field.tests
- DJANGO_VERSION=1.8 MODULE=multi_email_field.tests
- DJANGO_VERSION=1.9 MODULE=multi_email_field.tests
- DJANGO_VERSION=1.8.14 MODULE=multi_email_field.tests
- DJANGO_VERSION=1.9.9 MODULE=multi_email_field.tests
- DJANGO_VERSION=1.10 MODULE=multi_email_field.tests

install:
- pip install six pyquery
- pip install -q Django==$DJANGO_VERSION --use-mirrors
- pip install -q Django==$DJANGO_VERSION
- pip install coverage

script: coverage run quicktest.py $MODULE
Expand All @@ -26,39 +22,10 @@ after_success:
- pip install coveralls
- coveralls

# We need to exclude old versions of Django for tests with python 3.
# We need to exclude old versions of Python for tests with Django >= 1.7.
# We need to exclude old versions of Python for tests with Django >= 1.9.
matrix:
exclude:
- python: 3.3
env: DJANGO_VERSION=1.4 MODULE=multi_email_field
- python: 3.4
env: DJANGO_VERSION=1.4 MODULE=multi_email_field
- python: 3.5
env: DJANGO_VERSION=1.4 MODULE=multi_email_field
env: DJANGO_VERSION=1.9.9 MODULE=multi_email_field.tests
- python: 3.3
env: DJANGO_VERSION=1.5 MODULE=multi_email_field
- python: 3.4
env: DJANGO_VERSION=1.5 MODULE=multi_email_field
- python: 3.5
env: DJANGO_VERSION=1.5 MODULE=multi_email_field
- python: 3.3
env: DJANGO_VERSION=1.6 MODULE=multi_email_field
- python: 3.4
env: DJANGO_VERSION=1.6 MODULE=multi_email_field.tests
- python: 3.5
env: DJANGO_VERSION=1.6 MODULE=multi_email_field.tests
- python: 2.6
env: DJANGO_VERSION=1.7 MODULE=multi_email_field.tests
- python: 3.5
env: DJANGO_VERSION=1.7 MODULE=multi_email_field.tests
- python: 2.6
env: DJANGO_VERSION=1.8 MODULE=multi_email_field.tests
- python: 2.7
env: DJANGO_VERSION=1.8 MODULE=multi_email_field.tests
- python: 2.6
env: DJANGO_VERSION=1.9 MODULE=multi_email_field.tests
- python: 2.7
env: DJANGO_VERSION=1.9 MODULE=multi_email_field.tests
- python: 3.3
env: DJANGO_VERSION=1.9 MODULE=multi_email_field.tests
env: DJANGO_VERSION=1.10 MODULE=multi_email_field.tests
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ It provides:
COMPATIBILITY
==================

* Python 2.6/2.7/3.3/3.4/3.5
* Django 1.4/1.5/1.6/1.7/1.8/1.9
* Python 2.7/3.3/3.4/3.5
* Django 1.8/1.9/1.10

==================
INSTALL
Expand Down
14 changes: 5 additions & 9 deletions multi_email_field/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
class MultiEmailField(models.Field):
description = "A multi e-mail field stored as a multi-lines text"

__metaclass__ = models.SubfieldBase

def formfield(self, **kwargs):
# This is a fairly standard way to set up some defaults
# while letting the caller override them.
defaults = {'form_class': MultiEmailFormField}
defaults.update(kwargs)
return super(MultiEmailField, self).formfield(**defaults)

def from_db_value(self, value, expression, connection, context):
if value is None:
return []
return value.splitlines()

def get_db_prep_value(self, value, connection, prepared=False):
if isinstance(value, six.string_types):
return value
Expand All @@ -32,10 +35,3 @@ def to_python(self, value):

def get_internal_type(self):
return 'TextField'


try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["multi_email_field.fields.MultiEmailField"])
except ImportError:
pass

0 comments on commit 98c5b8c

Please sign in to comment.