mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-31 22:53:21 +02:00
Align API validation messages with UI; restore complete checks
- Match UI error messages for upload+data_file conflict and no-source case - Keep API-only guards for upload+data_source and data_source-without-data_file - Restore test_upload_with_data_source_fails Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -51,7 +51,7 @@ class ScriptModuleSerializer(ValidatedModelSerializer):
|
||||
|
||||
if upload_file and has_data_file:
|
||||
raise serializers.ValidationError(
|
||||
_("Cannot upload a file and sync from an existing data file.")
|
||||
_("Cannot upload a file and sync from an existing file")
|
||||
)
|
||||
if upload_file and has_data_source:
|
||||
raise serializers.ValidationError(
|
||||
@@ -63,7 +63,7 @@ class ScriptModuleSerializer(ValidatedModelSerializer):
|
||||
)
|
||||
if self.instance is None and not upload_file and not has_data_file:
|
||||
raise serializers.ValidationError(
|
||||
_("Must upload a file or provide a data source and data file to sync.")
|
||||
_("Must upload a file or select a data file to sync")
|
||||
)
|
||||
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user