mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	not sure if this works
This commit is contained in:
		| @@ -1,4 +1,5 @@ | |||||||
| import os | import os | ||||||
|  | import re | ||||||
| import tempfile | import tempfile | ||||||
| from datetime import datetime | from datetime import datetime | ||||||
| from time import mktime | from time import mktime | ||||||
| @@ -11,6 +12,17 @@ from pathvalidate import validate_filename, ValidationError | |||||||
|  |  | ||||||
| from documents.parsers import is_mime_type_supported | 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): | class UploadForm(forms.Form): | ||||||
|  |  | ||||||
|   | |||||||
| @@ -93,6 +93,10 @@ class DocumentTypeViewSet(ModelViewSet): | |||||||
|     ordering_fields = ("name", "matching_algorithm", "match", "document_count") |     ordering_fields = ("name", "matching_algorithm", "match", "document_count") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class BulkEditForm(object): | ||||||
|  |     pass | ||||||
|  |  | ||||||
|  |  | ||||||
| class DocumentViewSet(RetrieveModelMixin, | class DocumentViewSet(RetrieveModelMixin, | ||||||
|                       UpdateModelMixin, |                       UpdateModelMixin, | ||||||
|                       DestroyModelMixin, |                       DestroyModelMixin, | ||||||
| @@ -149,6 +153,13 @@ class DocumentViewSet(RetrieveModelMixin, | |||||||
|         else: |         else: | ||||||
|             return HttpResponseBadRequest(str(form.errors)) |             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) |     @action(methods=['get'], detail=True) | ||||||
|     def metadata(self, request, pk=None): |     def metadata(self, request, pk=None): | ||||||
|         try: |         try: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler