Closes #5370: Extend custom field support to organizational models

This commit is contained in:
Jeremy Stretch 2021-02-26 16:25:37 -05:00
parent 7e6cb9d186
commit 1dcd857ca6
10 changed files with 82 additions and 18 deletions

View File

@ -4,6 +4,10 @@
**WARNING:** This is a beta release and is not suitable for production use. It is intended for development and evaluation purposes only. No upgrade path to the final v2.11 release will be provided from this beta, and users should assume that all data entered into the application will be lost.
### Enhancements
* [#5370](https://github.com/netbox-community/netbox/issues/5370) - Extend custom field support to organizational models
### Other Changes
* [#1638](https://github.com/netbox-community/netbox/issues/1638) - Migrate all primary keys to 64-bit integers

View File

@ -1,5 +1,4 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
import django.core.serializers.json
from django.db import migrations, models
@ -10,6 +9,11 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='circuittype',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AlterField(
model_name='circuit',
name='id',

View File

@ -1,5 +1,4 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
import django.core.serializers.json
from django.db import migrations, models
@ -10,6 +9,36 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='devicerole',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='manufacturer',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='platform',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='rackgroup',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='rackrole',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='region',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AlterField(
model_name='cable',
name='id',

View File

@ -1,5 +1,3 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
from django.db import migrations, models

View File

@ -1,5 +1,4 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
import django.core.serializers.json
from django.db import migrations, models
@ -10,6 +9,21 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='rir',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='role',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='vlangroup',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AlterField(
model_name='aggregate',
name='id',

View File

@ -130,7 +130,7 @@ class PrimaryModel(ChangeLoggingMixin, CustomFieldsMixin, BigIDModel):
abstract = True
class NestedGroupModel(ChangeLoggingMixin, BigIDModel, MPTTModel):
class NestedGroupModel(ChangeLoggingMixin, CustomFieldsMixin, BigIDModel, MPTTModel):
"""
Base model for objects which are used to form a hierarchy (regions, locations, etc.). These models nest
recursively using MPTT. Within each parent, each child instance must have a unique name.
@ -173,7 +173,7 @@ class NestedGroupModel(ChangeLoggingMixin, BigIDModel, MPTTModel):
)
class OrganizationalModel(ChangeLoggingMixin, BigIDModel):
class OrganizationalModel(ChangeLoggingMixin, CustomFieldsMixin, BigIDModel):
"""
Organizational models are those which are used solely to categorize and qualify other objects, and do not convey
any real information about the infrastructure being modeled (for example, functional device roles). Organizational

View File

@ -1,5 +1,4 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
import django.core.serializers.json
from django.db import migrations, models
@ -10,6 +9,11 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='secretrole',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AlterField(
model_name='secret',
name='id',

View File

@ -1,5 +1,4 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
import django.core.serializers.json
from django.db import migrations, models
@ -10,6 +9,11 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='tenantgroup',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AlterField(
model_name='tenant',
name='id',

View File

@ -1,5 +1,3 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
from django.db import migrations, models

View File

@ -1,5 +1,4 @@
# Generated by Django 3.2b1 on 2021-02-26 21:11
import django.core.serializers.json
from django.db import migrations, models
@ -10,6 +9,16 @@ class Migration(migrations.Migration):
]
operations = [
migrations.AddField(
model_name='clustergroup',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AddField(
model_name='clustertype',
name='custom_field_data',
field=models.JSONField(blank=True, default=dict, encoder=django.core.serializers.json.DjangoJSONEncoder),
),
migrations.AlterField(
model_name='cluster',
name='id',