Skip to content

Commit 7cb067b

Browse files
committed
Handle both object types in field creation
1 parent 58c7ad2 commit 7cb067b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

netbox_custom_objects/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Meta:
4141
def validate(self, attrs):
4242
app_label = attrs.pop('app_label', None)
4343
model = attrs.pop('model', None)
44-
if attrs['type'] == 'object':
44+
if attrs['type'] in [CustomFieldTypeChoices.TYPE_OBJECT, CustomFieldTypeChoices.TYPE_MULTIOBJECT]:
4545
try:
4646
attrs['related_object_type'] = ContentType.objects.get(app_label=app_label, model=model)
4747
except ContentType.DoesNotExist:

0 commit comments

Comments
 (0)