Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions netbox_custom_objects/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,3 @@
)

APP_LABEL = "netbox_custom_objects"

# Field names that are reserved and cannot be used for custom object fields
RESERVED_FIELD_NAMES = [
"bookmarks",
"contacts",
"created",
"custom_field_data",
"id",
"images",
"jobs",
"journal_entries",
"last_updated",
"pk",
"subscriptions",
"tags",
]
12 changes: 1 addition & 11 deletions netbox_custom_objects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from utilities.string import title
from utilities.validators import validate_regex

from netbox_custom_objects.constants import APP_LABEL, RESERVED_FIELD_NAMES
from netbox_custom_objects.constants import APP_LABEL
from netbox_custom_objects.field_types import FIELD_TYPE_CLASS


Expand Down Expand Up @@ -813,16 +813,6 @@ def related_object_type_label(self):
def clean(self):
super().clean()

# Check if the field name is reserved
if self.name in RESERVED_FIELD_NAMES:
raise ValidationError(
{
"name": _(
'Field name "{name}" is reserved and cannot be used. Reserved names are: {reserved_names}'
).format(name=self.name, reserved_names=", ".join(RESERVED_FIELD_NAMES))
}
)

# Validate the field's default value (if any)
if self.default is not None:
try:
Expand Down