mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
document list validation.
This commit is contained in:
parent
80b47fa287
commit
f5df910894
@ -185,6 +185,13 @@ class BulkEditSerializer(serializers.Serializer):
|
|||||||
|
|
||||||
parameters = serializers.DictField(allow_empty=True)
|
parameters = serializers.DictField(allow_empty=True)
|
||||||
|
|
||||||
|
def validate_documents(self, documents):
|
||||||
|
count = Document.objects.filter(id__in=documents).count()
|
||||||
|
if not count == len(documents):
|
||||||
|
raise serializers.ValidationError(
|
||||||
|
"Some documents don't exist or were specified twice.")
|
||||||
|
return documents
|
||||||
|
|
||||||
def validate_method(self, method):
|
def validate_method(self, method):
|
||||||
if method == "set_correspondent":
|
if method == "set_correspondent":
|
||||||
return bulk_edit.set_correspondent
|
return bulk_edit.set_correspondent
|
||||||
|
Loading…
x
Reference in New Issue
Block a user