mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-19 12:15:20 +00:00
Backend support for excluded_documents
This commit is contained in:
1 parent
e8b7a98d3e
commit
2e7b3cb7fc
3 files changed
+90
-1
No files matched your search
@@ -1647,11 +1647,23 @@ class DocumentSelectionSerializer(DocumentListSerializer):
|
||||
write_only=True,
|
||||
)
|
||||
|
||||
excluded_documents = serializers.ListField(
|
||||
required=False,
|
||||
default=list,
|
||||
write_only=True,
|
||||
child=serializers.IntegerField(),
|
||||
)
|
||||
|
||||
def validate(self, attrs):
|
||||
if attrs.get("all", False):
|
||||
attrs.setdefault("documents", [])
|
||||
return attrs
|
||||
|
||||
if attrs["excluded_documents"]:
|
||||
raise serializers.ValidationError(
|
||||
"excluded_documents is only supported when all is true.",
|
||||
)
|
||||
|
||||
if "documents" not in attrs:
|
||||
raise serializers.ValidationError(
|
||||
"documents is required unless all is true.",
|
||||
|
||||
Reference in new issue
Block a user