mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-01 09:41:22 +00:00
Skip constraint checking in NoteSerializer
This commit is contained in:
@@ -878,6 +878,14 @@ class NoteSerializer(FilterableSerializerMixin, InvenTreeModelSerializer):
|
|||||||
|
|
||||||
read_only_fields = ['updated', 'updated_by']
|
read_only_fields = ['updated', 'updated_by']
|
||||||
|
|
||||||
|
def get_unique_together_validators(self):
|
||||||
|
"""Skip the auto-generated 'unique_primary_note_per_model' validator.
|
||||||
|
|
||||||
|
That constraint is deliberately enforced by Note.save() by demoting
|
||||||
|
sibling notes, rather than rejecting requests that set 'primary'.
|
||||||
|
"""
|
||||||
|
return []
|
||||||
|
|
||||||
def validate(self, data):
|
def validate(self, data):
|
||||||
"""Validate note data — templates need no model_id; regular notes require both."""
|
"""Validate note data — templates need no model_id; regular notes require both."""
|
||||||
data = super().validate(data)
|
data = super().validate(data)
|
||||||
|
|||||||
Reference in New Issue
Block a user