Skip to content

Commit 8c9bb73

Browse files
committed
Fixes #17810: Disable DRF's native unique constraint checks
1 parent 327ad8c commit 8c9bb73

File tree

1 file changed

+6
-0
lines changed
  • netbox/netbox/api/serializers

1 file changed

+6
-0
lines changed

netbox/netbox/api/serializers/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ class ValidatedModelSerializer(BaseModelSerializer):
7676
Extends the built-in ModelSerializer to enforce calling full_clean() on a copy of the associated instance during
7777
validation. (DRF does not do this by default; see https://github.com/encode/django-rest-framework/issues/3144)
7878
"""
79+
80+
# Bypass DRF's built-in validation of unique constraints due to DRF bug #9410. Rely instead
81+
# on our own custom model validation (below).
82+
def get_unique_together_constraints(self, model):
83+
return []
84+
7985
def validate(self, data):
8086

8187
# Skip validation if we're being used to represent a nested object

0 commit comments

Comments
 (0)