A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Merge branch 'master' into dev
Jonas Winkler13725ef8ee7e
diff --cc paperless.conf.exampleindex d42d5ca5f,8aa33216f..0434b590dmode 100755,100644..100755--- a/paperless.conf.example+++ b/paperless.conf.examplediff --cc src/documents/admin.pyindex 65548d91f,02e9cd56b..df0811f2d--- a/src/documents/admin.py+++ b/src/documents/admin.py@@@ -1,20 -1,42 +1,22 @@@-from datetime import datetime+from datetime import datetime, timedeltafrom django.conf import settings-from django.contrib import admin+from django.contrib import admin, messages+from django.contrib.admin.templatetags.admin_urls import add_preserved_filtersfrom django.contrib.auth.models import User, Group- from django.http import HttpResponseRedirect- from django.urls import reverse+ try:+ from django.core.urlresolvers import reverse+ except ImportError:+ from django.urls import reversefrom django.templatetags.static import static+from django.utils.html import format_html+from django.utils.http import urlquotefrom django.utils.safestring import mark_safe-from django.utils.html import format_html, format_html_join+from django.db import models-from .models import Correspondent, Tag, Document, Log---class MonthListFilter(admin.SimpleListFilter):-- title = "Month"-- # Parameter for the filter that will be used in the URL query.- parameter_name = "month"-- def lookups(self, request, model_admin):- r = []- for document in Document.objects.all():- r.append((- document.created.strftime("%Y-%m"),- document.created.strftime("%B %Y")- ))- return sorted(set(r), key=lambda x: x[0], reverse=True)-- def queryset(self, request, queryset):-- if not self.value():- return None-- year, month = self.value().split("-")- return queryset.filter(created__year=year, created__month=month)+from documents.actions import add_tag_to_selected, remove_tag_from_selected, set_correspondent_on_selected, \+ remove_correspondent_from_selected, set_document_type_on_selected, remove_document_type_from_selected+from .models import Correspondent, Tag, Document, Log, DocumentTypeclass FinancialYearFilter(admin.SimpleListFilter):@@@ -186,17 -139,13 +188,19 @@@ class DocumentAdmin(CommonAdmin)search_fields = ("correspondent__name", "title", "content", "tags__name")readonly_fields = ("added",)list_display = ("title", "created", "added", "thumbnail", "correspondent",- "tags_")- list_filter = ("tags", "correspondent", FinancialYearFilter,- MonthListFilter)+ "tags_", "archive_serial_number", "document_type")+ list_filter = ("document_type", "tags", ('correspondent', RecentCorrespondentFilter), "correspondent", FinancialYearFilter)++ filter_horizontal = ("tags",)+ordering = ["-created", "correspondent"]+ actions = [add_tag_to_selected, remove_tag_from_selected, set_correspondent_on_selected, remove_correspondent_from_selected, set_document_type_on_selected, remove_document_type_from_selected]++ date_hierarchy = 'created'++ document_queue = None+def has_add_permission(self, request):return Falsediff --cc src/documents/filters.pyindex 77f14928b,68861d967..780491a14mode 100755,100644..100755--- a/src/documents/filters.py+++ b/src/documents/filters.py@@@ -1,6 -1,6 +1,6 @@@- from django_filters.rest_framework import CharFilter, FilterSet+ from django_filters.rest_framework import CharFilter, FilterSet, BooleanFilter-from .models import Correspondent, Document, Tag+from .models import Correspondent, Document, Tag, DocumentTypeclass CorrespondentFilterSet(FilterSet):@@@ -55,14 -42,18 +55,22 @@@ class DocumentFilterSet(FilterSet))}- correspondent__name = CharFilter(name="correspondent__name", **CHAR_KWARGS)- correspondent__slug = CharFilter(name="correspondent__slug", **CHAR_KWARGS)- tags__name = CharFilter(name="tags__name", **CHAR_KWARGS)- tags__slug = CharFilter(name="tags__slug", **CHAR_KWARGS)- document_type__name = CharFilter(name="document_type__name", **CHAR_KWARGS)- document_type__slug = CharFilter(name="document_type__slug", **CHAR_KWARGS)+ correspondent__name = CharFilter(+ field_name="correspondent__name", **CHAR_KWARGS)+ correspondent__slug = CharFilter(+ field_name="correspondent__slug", **CHAR_KWARGS)+ tags__name = CharFilter(+ field_name="tags__name", **CHAR_KWARGS)+ tags__slug = CharFilter(+ field_name="tags__slug", **CHAR_KWARGS)+ tags__empty = BooleanFilter(+ field_name="tags", lookup_expr="isnull", distinct=True)++ document_type__name = CharFilter(++ name="document_type__name", **CHAR_KWARGS)++ document_type__slug = CharFilter(++ name="document_type__slug", **CHAR_KWARGS)- class Meta(object):+ class Meta:model = Documentfields = {"title": [diff --cc src/documents/serialisers.pyindex 99e71917f,f71a0c5ab..61cdea8c7mode 100755,100644..100755--- a/src/documents/serialisers.py+++ b/src/documents/serialisers.py@@@ -10,16 -10,9 +10,16 @@@ class CorrespondentSerializer(serializefields = ("id", "slug", "name")+class DocumentTypeSerializer(serializers.HyperlinkedModelSerializer):++ class Meta(object):+ model = DocumentType+ fields = ("id", "slug", "name")++class TagSerializer(serializers.HyperlinkedModelSerializer):- class Meta(object):+ class Meta:model = Tagfields = ("id", "slug", "name", "colour", "match", "matching_algorithm")@@@ -45,10 -33,8 +45,10 @@@ class DocumentSerializer(serializers.Mocorrespondent = CorrespondentField(view_name="drf:correspondent-detail", allow_null=True)tags = TagsField(view_name="drf:tag-detail", many=True)+ document_type = DocumentTypeField(+ view_name="drf:documenttype-detail", allow_null=True)- class Meta(object):+ class Meta:model = Documentfields = ("id",