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

Change Postgres-specific JSONField to stock Django field

This commit is contained in:
Jeremy Stretch
2020-07-16 12:02:49 -04:00
parent 68ecddccdb
commit 21a750e8ec
8 changed files with 101 additions and 11 deletions

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1b1 on 2020-07-16 16:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dcim', '0113_nullbooleanfield_to_booleanfield'),
]
operations = [
migrations.AlterField(
model_name='device',
name='local_context_data',
field=models.JSONField(blank=True, null=True),
),
migrations.AlterField(
model_name='platform',
name='napalm_args',
field=models.JSONField(blank=True, null=True),
),
]

View File

@ -6,7 +6,7 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
@ -1280,7 +1280,7 @@ class Platform(ChangeLoggedModel):
verbose_name='NAPALM driver',
help_text='The name of the NAPALM driver to use when interacting with devices'
)
napalm_args = JSONField(
napalm_args = models.JSONField(
blank=True,
null=True,
verbose_name='NAPALM arguments',

View File

@ -0,0 +1,28 @@
# Generated by Django 3.1b1 on 2020-07-16 16:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('extras', '0045_configcontext_changelog'),
]
operations = [
migrations.AlterField(
model_name='configcontext',
name='data',
field=models.JSONField(),
),
migrations.AlterField(
model_name='jobresult',
name='data',
field=models.JSONField(blank=True, null=True),
),
migrations.AlterField(
model_name='objectchange',
name='object_data',
field=models.JSONField(editable=False),
),
]

View File

@ -1,7 +1,6 @@
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.urls import reverse
@ -104,7 +103,7 @@ class ObjectChange(models.Model):
max_length=200,
editable=False
)
object_data = JSONField(
object_data = models.JSONField(
editable=False
)

View File

@ -5,7 +5,6 @@ from collections import OrderedDict
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField
from django.core.validators import ValidationError
from django.db import models
from django.http import HttpResponse
@ -499,7 +498,7 @@ class ConfigContext(ChangeLoggedModel):
related_name='+',
blank=True
)
data = JSONField()
data = models.JSONField()
objects = ConfigContextQuerySet.as_manager()
@ -526,7 +525,7 @@ class ConfigContextModel(models.Model):
A model which includes local configuration context data. This local data will override any inherited data from
ConfigContexts.
"""
local_context_data = JSONField(
local_context_data = models.JSONField(
blank=True,
null=True,
)
@ -627,7 +626,7 @@ class JobResult(models.Model):
choices=JobResultStatusChoices,
default=JobResultStatusChoices.STATUS_PENDING
)
data = JSONField(
data = models.JSONField(
null=True,
blank=True
)

View File

@ -0,0 +1,23 @@
# Generated by Django 3.1b1 on 2020-07-16 16:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0009_replicate_permissions'),
]
operations = [
migrations.AlterField(
model_name='objectpermission',
name='constraints',
field=models.JSONField(blank=True, null=True),
),
migrations.AlterField(
model_name='userconfig',
name='data',
field=models.JSONField(default=dict),
),
]

View File

@ -3,7 +3,7 @@ import os
from django.contrib.auth.models import Group, User
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import ArrayField, JSONField
from django.contrib.postgres.fields import ArrayField
from django.core.validators import MinLengthValidator
from django.db import models
from django.db.models.signals import post_save
@ -56,7 +56,7 @@ class UserConfig(models.Model):
on_delete=models.CASCADE,
related_name='config'
)
data = JSONField(
data = models.JSONField(
default=dict
)
@ -265,7 +265,7 @@ class ObjectPermission(models.Model):
base_field=models.CharField(max_length=30),
help_text="The list of actions granted by this permission"
)
constraints = JSONField(
constraints = models.JSONField(
blank=True,
null=True,
help_text="Queryset filter matching the applicable objects of the selected type(s)"

View File

@ -0,0 +1,18 @@
# Generated by Django 3.1b1 on 2020-07-16 16:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('virtualization', '0016_replicate_interfaces'),
]
operations = [
migrations.AlterField(
model_name='virtualmachine',
name='local_context_data',
field=models.JSONField(blank=True, null=True),
),
]