diff --git a/.travis.yml b/.travis.yml index 872121c21..4ad37604e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ services: - postgresql - redis-server addons: - postgresql: "9.4" + postgresql: "9.6" language: python python: - - "3.5" + - "3.6" install: - pip install -r requirements.txt - pip install pycodestyle diff --git a/netbox/dcim/migrations/0097_mptt_remove_indexes.py b/netbox/dcim/migrations/0097_mptt_remove_indexes.py new file mode 100644 index 000000000..3011edb53 --- /dev/null +++ b/netbox/dcim/migrations/0097_mptt_remove_indexes.py @@ -0,0 +1,28 @@ +# Generated by Django 3.0.3 on 2020-02-18 21:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dcim', '0096_interface_ordering'), + ] + + operations = [ + migrations.AlterField( + model_name='region', + name='level', + field=models.PositiveIntegerField(editable=False), + ), + migrations.AlterField( + model_name='region', + name='lft', + field=models.PositiveIntegerField(editable=False), + ), + migrations.AlterField( + model_name='region', + name='rght', + field=models.PositiveIntegerField(editable=False), + ), + ] diff --git a/netbox/dcim/tests/test_api.py b/netbox/dcim/tests/test_api.py index c0ea5eca7..607637d1e 100644 --- a/netbox/dcim/tests/test_api.py +++ b/netbox/dcim/tests/test_api.py @@ -40,7 +40,7 @@ class AppTest(APITestCase): self.assertEqual(choices_to_dict(response.data.get('cable:status')), CableStatusChoices.as_dict()) content_types = ContentType.objects.filter(CABLE_TERMINATION_MODELS) cable_termination_choices = { - "{}.{}".format(ct.app_label, ct.model): ct.name for ct in content_types + "{}.{}".format(ct.app_label, ct.model): str(ct) for ct in content_types } self.assertEqual(choices_to_dict(response.data.get('cable:termination_a_type')), cable_termination_choices) self.assertEqual(choices_to_dict(response.data.get('cable:termination_b_type')), cable_termination_choices) diff --git a/netbox/extras/forms.py b/netbox/extras/forms.py index d6a5406b7..b792ec484 100644 --- a/netbox/extras/forms.py +++ b/netbox/extras/forms.py @@ -467,7 +467,8 @@ class ScriptForm(BootstrapMixin, forms.Form): self.fields['_commit'].initial = False # Move _commit to the end of the form - self.fields.move_to_end('_commit', True) + commit = self.fields.pop('_commit') + self.fields['_commit'] = commit @property def requires_input(self): diff --git a/netbox/extras/tests/test_api.py b/netbox/extras/tests/test_api.py index b15553a49..db2861f46 100644 --- a/netbox/extras/tests/test_api.py +++ b/netbox/extras/tests/test_api.py @@ -37,7 +37,7 @@ class AppTest(APITestCase): # Graph content_types = ContentType.objects.filter(GRAPH_MODELS) graph_type_choices = { - "{}.{}".format(ct.app_label, ct.model): ct.name for ct in content_types + "{}.{}".format(ct.app_label, ct.model): str(ct) for ct in content_types } self.assertEqual(choices_to_dict(response.data.get('graph:type')), graph_type_choices) self.assertEqual(choices_to_dict(response.data.get('graph:template_language')), TemplateLanguageChoices.as_dict()) diff --git a/netbox/secrets/__init__.py b/netbox/secrets/__init__.py index e69de29bb..3c1c4eed2 100644 --- a/netbox/secrets/__init__.py +++ b/netbox/secrets/__init__.py @@ -0,0 +1,11 @@ +# TODO: Rename the secrets app, probably +# Python 3.6 introduced a standard library named "secrets," which obviously conflicts with this Django app. To avoid +# renaming the app, we hotwire the components of the standard library that Django calls. (I don't like this any more +# than you do, but it works for now.) The only references to the secrets modules are in django/utils/crypto.py. +# +# First, we copy secrets.compare_digest, which comes from the hmac module: +from hmac import compare_digest + +# Then, we instantiate SystemRandom and map its choice() function: +from random import SystemRandom +choice = SystemRandom().choice diff --git a/requirements.txt b/requirements.txt index b0b1b971d..c3b35e8fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -Django>=2.2,<2.3 +Django>=3.0,<3.1 django-cacheops==4.2 django-cors-headers==3.2.1 -django-debug-toolbar==2.1 +django-debug-toolbar==2.2 django-filter==2.2.0 -django-mptt==0.9.1 +django-mptt==0.11.0 django-pglocks==1.0.4 django-prometheus==1.1.0 django-rq==2.2.0