mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	not sure if this works
This commit is contained in:
		@@ -1,4 +1,5 @@
 | 
			
		||||
import os
 | 
			
		||||
import re
 | 
			
		||||
import tempfile
 | 
			
		||||
from datetime import datetime
 | 
			
		||||
from time import mktime
 | 
			
		||||
@@ -11,6 +12,17 @@ from pathvalidate import validate_filename, ValidationError
 | 
			
		||||
 | 
			
		||||
from documents.parsers import is_mime_type_supported
 | 
			
		||||
 | 
			
		||||
class BuldEditForm(forms.Form):
 | 
			
		||||
 | 
			
		||||
    def clean_ids(self):
 | 
			
		||||
        ids = self.cleaned_data.get("ids")
 | 
			
		||||
        if not re.match(r"[0-9,]+", ids):
 | 
			
		||||
            raise forms.ValidationError("id list invalid")
 | 
			
		||||
        id_list = [int(id) for id in ids.split(",")]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class UploadForm(forms.Form):
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -93,6 +93,10 @@ class DocumentTypeViewSet(ModelViewSet):
 | 
			
		||||
    ordering_fields = ("name", "matching_algorithm", "match", "document_count")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class BulkEditForm(object):
 | 
			
		||||
    pass
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class DocumentViewSet(RetrieveModelMixin,
 | 
			
		||||
                      UpdateModelMixin,
 | 
			
		||||
                      DestroyModelMixin,
 | 
			
		||||
@@ -149,6 +153,13 @@ class DocumentViewSet(RetrieveModelMixin,
 | 
			
		||||
        else:
 | 
			
		||||
            return HttpResponseBadRequest(str(form.errors))
 | 
			
		||||
 | 
			
		||||
    @action(methods=['post'], detail=False)
 | 
			
		||||
    def bulk_edit(self, request, pk=None):
 | 
			
		||||
        form = BulkEditForm(data=request.POST)
 | 
			
		||||
        if not form.is_valid():
 | 
			
		||||
            return HttpResponseBadRequest("")
 | 
			
		||||
        return Response({'asd': request.POST['content']})
 | 
			
		||||
 | 
			
		||||
    @action(methods=['get'], detail=True)
 | 
			
		||||
    def metadata(self, request, pk=None):
 | 
			
		||||
        try:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user