Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Adds the ability for the user to configure the number of items per page.

Daniel Quinn69ea039e31cd
diff --git a/paperless.conf.example b/paperless.conf.example
index 0d82dd7ef..005a22584 100644
--- a/paperless.conf.example
+++ b/paperless.conf.example
@@ -65,8 +65,8 @@ PAPERLESS_SHARED_SECRET=""
# cases it has proven useful to configure a lesser value.
# This setting has a high impact on the physical size of tmp page files,
# the speed of document conversion, and can affect the accuracy of OCR
-# results. Individual results can vary and this setting should be tested
-# thoroughly against the documents you are importing to see if it has any
+# results. Individual results can vary and this setting should be tested
+# thoroughly against the documents you are importing to see if it has any
# impacts either negative or positive. Testing on limited document sets has
# shown a setting of 200 can cut the size of tmp files by 1/3, and speed up
# conversion by up to 4x with little impact to OCR accuracy.
@@ -81,7 +81,7 @@ PAPERLESS_SHARED_SECRET=""
# the web for "MAGICK_TMPDIR".
#PAPERLESS_CONVERT_TMPDIR=/var/tmp/paperless
-# You can specify where you want the SQLite database to be stored instead of
+# You can specify where you want the SQLite database to be stored instead of
# the default location
#PAPERLESS_DBDIR=/path/to/database/file
@@ -112,3 +112,7 @@ PAPERLESS_SHARED_SECRET=""
# documents. It should be a 3-letter language code consistent with ISO 639.
#PAPERLESS_OCR_LANGUAGE=eng
+# The number of items on each page in the web UI. This value must be a
+# positive integer, but if you don't define one in paperless.conf, a default of
+# 100 will be used.
+#PAPERLESS_LIST_PER_PAGE=100
diff --git a/src/documents/admin.py b/src/documents/admin.py
index 8724236a8..0601f579e 100644
--- a/src/documents/admin.py
+++ b/src/documents/admin.py
@@ -1,3 +1,4 @@
+from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import User, Group
from django.core.urlresolvers import reverse
@@ -31,21 +32,25 @@ class MonthListFilter(admin.SimpleListFilter):
return queryset.filter(created__year=year, created__month=month)
-class CorrespondentAdmin(admin.ModelAdmin):
+class CommonAdmin(admin.ModelAdmin):
+ list_per_page = settings.PAPERLESS_LIST_PER_PAGE
+
+
+class CorrespondentAdmin(CommonAdmin):
list_display = ("name", "match", "matching_algorithm")
list_filter = ("matching_algorithm",)
list_editable = ("match", "matching_algorithm")
-class TagAdmin(admin.ModelAdmin):
+class TagAdmin(CommonAdmin):
list_display = ("name", "colour", "match", "matching_algorithm")
list_filter = ("colour", "matching_algorithm")
list_editable = ("colour", "match", "matching_algorithm")
-class DocumentAdmin(admin.ModelAdmin):
+class DocumentAdmin(CommonAdmin):
class Media:
css = {
@@ -119,7 +124,7 @@ class DocumentAdmin(admin.ModelAdmin):
return "<{} {}/>".format(kind, " ".join(attributes))
-class LogAdmin(admin.ModelAdmin):
+class LogAdmin(CommonAdmin):
list_display = ("created", "message", "level",)
list_filter = ("level", "created",)
diff --git a/src/paperless/settings.py b/src/paperless/settings.py
index 2b3f9f5dc..ff67cc528 100644
--- a/src/paperless/settings.py
+++ b/src/paperless/settings.py
@@ -249,3 +249,8 @@ SHARED_SECRET = os.getenv("PAPERLESS_SHARED_SECRET", "")
# Trigger a script after every successful document consumption?
PRE_CONSUME_SCRIPT = os.getenv("PAPERLESS_PRE_CONSUME_SCRIPT")
POST_CONSUME_SCRIPT = os.getenv("PAPERLESS_POST_CONSUME_SCRIPT")
+
+# The number of items on each page in the web UI. This value must be a
+# positive integer, but if you don't define one in paperless.conf, a default of
+# 100 will be used.
+PAPERLESS_LIST_PER_PAGE = int(os.getenv("PAPERLESS_LIST_PER_PAGE", 100))