Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ matrix:
env: TOX_ENV=py36-django22
- python: 3.7
env: TOX_ENV=py37-django22
- python: 3.6
env: TOX_ENV=py36-django30
- python: 3.7
env: TOX_ENV=py37-django30

install:
- pip install tox
Expand Down
8 changes: 8 additions & 0 deletions netfields/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django import VERSION

if VERSION[0] <= 2:
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
from django.utils.six import with_metaclass, text_type
else:
from django.db.backends.postgresql.base import DatabaseWrapper
from six import with_metaclass, text_type
11 changes: 1 addition & 10 deletions netfields/fields.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
from django.core.exceptions import ValidationError
from django.db import models

from django import VERSION

if VERSION[0] <= 2:
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper
from django.utils.six import with_metaclass, text_type
else:
from django.db.backends.postgresql.base import DatabaseWrapper
from six import with_metaclass, text_type

from django.utils.six import with_metaclass, text_type
from ipaddress import ip_interface, ip_network
from netaddr import EUI
from netaddr.core import AddrFormatError

from netfields.compat import DatabaseWrapper, with_metaclass, text_type
from netfields.forms import InetAddressFormField, CidrAddressFormField, MACAddressFormField
from netfields.mac import mac_unix_common
from netfields.psycopg2_types import Inet, Macaddr
Expand Down
2 changes: 1 addition & 1 deletion netfields/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from netaddr import EUI, AddrFormatError

from django import forms
from django.utils.six import text_type
from django.core.exceptions import ValidationError

from netfields.compat import text_type
from netfields.mac import mac_unix_common


Expand Down
2 changes: 1 addition & 1 deletion netfields/rest_framework.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from __future__ import absolute_import

from django.utils.six import text_type
from ipaddress import ip_interface, ip_network, ip_address
from netaddr import EUI
from netaddr.core import AddrFormatError
from rest_framework import serializers

from netfields.compat import text_type
from netfields.mac import mac_unix_common


Expand Down
20 changes: 20 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ envlist=
py35-django22,
py36-django22,
py37-django22,
py36-django30,
py37-django30,



Expand Down Expand Up @@ -327,3 +329,21 @@ deps=
psycopg2
djangorestframework
unittest2

[testenv:py36-django30]
basepython=python3.6
deps=
django>=3.0,<3.1
netaddr
psycopg2
djangorestframework
unittest2

[testenv:py37-django30]
basepython=python3.7
deps=
django>=3.0,<3.1
netaddr
psycopg2
djangorestframework
unittest2