1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merge pull request #4207 from netbox-community/3848-django-3.0

Closes #3848: Django 3.0
This commit is contained in:
Jeremy Stretch
2020-02-19 15:41:39 -05:00
committed by GitHub
7 changed files with 48 additions and 8 deletions

View File

@ -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

View File

@ -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),
),
]

View File

@ -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)

View File

@ -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):

View File

@ -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())

View File

@ -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

View File

@ -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