We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3348080 commit 5d25d8aCopy full SHA for 5d25d8a
openwisp_controller/pki/api/serializers.py
@@ -73,7 +73,12 @@ class Meta:
73
]
74
read_only_fields = ["created", "modified"]
75
extra_kwargs = {
76
- "organization": {"required": True},
+ # In DRF 3.16+, nullable fields that are part of a unique constraint
77
+ # automatically get `default: None`, which can cause validation issues.
78
+ # Setting the default to `serializers.empty` ensures DRF does not treat
79
+ # these fields as both required and having a default value, avoiding
80
+ # conflicts.
81
+ "organization": {"required": True, "default": serializers.empty},
82
"common_name": {"default": "", "required": False},
83
"key_length": {"initial": "2048"},
84
"digest": {"initial": "sha256"},
0 commit comments