mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
feat(settings): add setting to set number of suggested dates
This commit is contained in:
parent
f6e4339069
commit
f1084cbdcf
@ -69,6 +69,7 @@
|
|||||||
#PAPERLESS_POST_CONSUME_SCRIPT=/path/to/an/arbitrary/script.sh
|
#PAPERLESS_POST_CONSUME_SCRIPT=/path/to/an/arbitrary/script.sh
|
||||||
#PAPERLESS_FILENAME_DATE_ORDER=YMD
|
#PAPERLESS_FILENAME_DATE_ORDER=YMD
|
||||||
#PAPERLESS_FILENAME_PARSE_TRANSFORMS=[]
|
#PAPERLESS_FILENAME_PARSE_TRANSFORMS=[]
|
||||||
|
#PAPERLESS_NUMBER_OF_SUGGESTION_DATES=5
|
||||||
#PAPERLESS_THUMBNAIL_FONT_NAME=
|
#PAPERLESS_THUMBNAIL_FONT_NAME=
|
||||||
#PAPERLESS_IGNORE_DATES=
|
#PAPERLESS_IGNORE_DATES=
|
||||||
#PAPERLESS_ENABLE_UPDATE_CHECK=
|
#PAPERLESS_ENABLE_UPDATE_CHECK=
|
||||||
|
@ -337,7 +337,9 @@ class DocumentViewSet(
|
|||||||
classifier = load_classifier()
|
classifier = load_classifier()
|
||||||
|
|
||||||
gen = parse_date_generator(doc.filename, doc.content)
|
gen = parse_date_generator(doc.filename, doc.content)
|
||||||
dates = {i for i in itertools.islice(gen, 5)}
|
dates = sorted(
|
||||||
|
{i for i in itertools.islice(gen, settings.NUMBER_OF_SUGGESTED_DATES)},
|
||||||
|
)
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
|
@ -588,6 +588,11 @@ POST_CONSUME_SCRIPT = os.getenv("PAPERLESS_POST_CONSUME_SCRIPT")
|
|||||||
DATE_ORDER = os.getenv("PAPERLESS_DATE_ORDER", "DMY")
|
DATE_ORDER = os.getenv("PAPERLESS_DATE_ORDER", "DMY")
|
||||||
FILENAME_DATE_ORDER = os.getenv("PAPERLESS_FILENAME_DATE_ORDER")
|
FILENAME_DATE_ORDER = os.getenv("PAPERLESS_FILENAME_DATE_ORDER")
|
||||||
|
|
||||||
|
# Number of dates used as suggestions in the frontend
|
||||||
|
# The number counter from top to bottom.
|
||||||
|
# Duplicates will be removed, which will result in less shown suggestion dates.
|
||||||
|
NUMBER_OF_SUGGESTED_DATES = __get_int("PAPERLESS_NUMBER_OF_SUGGESTED_DATES", 0)
|
||||||
|
|
||||||
# Transformations applied before filename parsing
|
# Transformations applied before filename parsing
|
||||||
FILENAME_PARSE_TRANSFORMS = []
|
FILENAME_PARSE_TRANSFORMS = []
|
||||||
for t in json.loads(os.getenv("PAPERLESS_FILENAME_PARSE_TRANSFORMS", "[]")):
|
for t in json.loads(os.getenv("PAPERLESS_FILENAME_PARSE_TRANSFORMS", "[]")):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user