Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit e5ee369

Browse files
committed
[deps] Improved PR #99 (drop python2 and add django 3.0)
1 parent b006137 commit e5ee369

20 files changed

Lines changed: 34 additions & 26 deletions

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ branches:
1111
- master
1212

1313
env:
14-
- DJANGO="django>=2.2,<3.3"
14+
- DJANGO="django>=2.2,<3.0"
15+
- DJANGO="django>=3.0,<3.1"
16+
1517
before_install:
1618
- pip install -U pip wheel setuptools
1719
- pip install --no-cache-dir -U -r requirements-test.txt
@@ -22,10 +24,13 @@ install:
2224
- pip install $DJANGO
2325
- python setup.py -q develop
2426

27+
before_script:
28+
- |
29+
openwisp-utils-qa-checks --migration-path "./django_netjsongraph/migrations" \
30+
--migration-module django_netjsongraph
31+
2532
script:
2633
- coverage run --source=django_netjsongraph runtests.py
27-
- ./tests/manage.py makemigrations django_netjsongraph --dry-run | grep "No changes detected";
28-
- openwisp-utils-qa-checks --migration-path "./django_netjsongraph/migrations"
2934

3035
after_success:
3136
coveralls

django_netjsongraph/api/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import views
21
from ..utils import get_api_urls
2+
from . import views
33

44
urlpatterns = get_api_urls(views)

django_netjsongraph/base/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from django.conf.urls import url
22
from django.contrib import messages
33
from django.contrib.admin import ModelAdmin
4-
from django.templatetags.static import static
54
from django.db.models import Q
65
from django.template.response import TemplateResponse
6+
from django.templatetags.static import static
77
from django.urls import reverse
88
from django.utils.translation import ugettext_lazy as _
99

django_netjsongraph/base/topology.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def link_status_changed(self, link, status):
276276
# if using fetch strategy or
277277
# using receive strategy and link is coming back up or
278278
# receive strategy and ``expiration_time is 0``
279-
elif self.strategy == 'fetch' or status == 'up' or self.expiration_time is 0:
279+
elif self.strategy == 'fetch' or status == 'up' or self.expiration_time == 0:
280280
return True
281281
# if using receive strategy and expiration_time of link has expired
282282
elif link.modified < (now() - timedelta(seconds=self.expiration_time)):

django_netjsongraph/management/commands/save_snapshot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from . import BaseSaveSnapshotCommand
21
from ...models import Topology
2+
from . import BaseSaveSnapshotCommand
33

44

55
class Command(BaseSaveSnapshotCommand):

django_netjsongraph/management/commands/update_topology.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from . import BaseUpdateCommand
21
from ...models import Topology
2+
from . import BaseUpdateCommand
33

44

55
class Command(BaseUpdateCommand):

django_netjsongraph/migrations/0001_initial.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# -*- coding: utf-8 -*-
22
# Generated by Django 1.9 on 2015-12-23 09:04
3+
# Edited manually on 2020-01-20
4+
import collections
35
import uuid
46

57
import django.db.models.deletion
@@ -26,7 +28,7 @@ class Migration(migrations.Migration):
2628
('cost', models.FloatField()),
2729
('cost_text', models.CharField(blank=True, max_length=24)),
2830
('status', model_utils.fields.StatusField(choices=[('up', 'up'), ('down', 'down')], default='up', max_length=100, no_check_for_status=True)),
29-
('properties', jsonfield.fields.JSONField(blank=True, default=dict)),
31+
('properties', jsonfield.fields.JSONField(blank=True, default=dict, dump_kwargs={'indent': 4}, load_kwargs={'object_pairs_hook': collections.OrderedDict})),
3032
],
3133
options={
3234
'abstract': False,
@@ -40,7 +42,7 @@ class Migration(migrations.Migration):
4042
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
4143
('label', models.CharField(blank=True, max_length=64)),
4244
('addresses', models.CharField(db_index=True, max_length=255)),
43-
('properties', jsonfield.fields.JSONField(blank=True, default=dict)),
45+
('properties', jsonfield.fields.JSONField(blank=True, default=dict, dump_kwargs={'indent': 4}, load_kwargs={'object_pairs_hook': collections.OrderedDict})),
4446
],
4547
options={
4648
'abstract': False,

django_netjsongraph/tests/base/test_link.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def test_json(self):
3939
t = self.topology_model.objects.first()
4040
node1, node2 = self._get_nodes()
4141
link = t._create_link(source=node1, target=node2, cost=1.0,
42-
cost_text='100mbit/s', properties='{"pretty": true}')
42+
cost_text='100mbit/s',
43+
properties={"pretty": True})
4344
self.assertEqual(dict(link.json(dict=True)), {
4445
'source': '192.168.0.1',
4546
'target': '192.168.0.2',

django_netjsongraph/tests/base/test_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_json(self):
5151
t = self.topology_model.objects.first()
5252
n = t._create_node(label='test node',
5353
addresses=['192.168.0.1', '10.0.0.1'],
54-
properties='{"gateway": true}')
54+
properties={"gateway": True})
5555
self.assertEqual(dict(n.json(dict=True)), {
5656
'id': '192.168.0.1',
5757
'label': 'test node',

django_netjsongraph/tests/test_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.test import TestCase
22

3-
from . import CreateGraphObjectsMixin
43
from ..models import Link, Node, Topology
4+
from . import CreateGraphObjectsMixin
55
from .base.test_admin import TestAdminMixin
66

77

0 commit comments

Comments
 (0)