mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	feat(settings): add setting to set number of suggested dates
This commit is contained in:
		@@ -69,6 +69,7 @@
 | 
			
		||||
#PAPERLESS_POST_CONSUME_SCRIPT=/path/to/an/arbitrary/script.sh
 | 
			
		||||
#PAPERLESS_FILENAME_DATE_ORDER=YMD
 | 
			
		||||
#PAPERLESS_FILENAME_PARSE_TRANSFORMS=[]
 | 
			
		||||
#PAPERLESS_NUMBER_OF_SUGGESTION_DATES=5
 | 
			
		||||
#PAPERLESS_THUMBNAIL_FONT_NAME=
 | 
			
		||||
#PAPERLESS_IGNORE_DATES=
 | 
			
		||||
#PAPERLESS_ENABLE_UPDATE_CHECK=
 | 
			
		||||
 
 | 
			
		||||
@@ -337,7 +337,9 @@ class DocumentViewSet(
 | 
			
		||||
        classifier = load_classifier()
 | 
			
		||||
 | 
			
		||||
        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(
 | 
			
		||||
            {
 | 
			
		||||
 
 | 
			
		||||
@@ -588,6 +588,11 @@ POST_CONSUME_SCRIPT = os.getenv("PAPERLESS_POST_CONSUME_SCRIPT")
 | 
			
		||||
DATE_ORDER = os.getenv("PAPERLESS_DATE_ORDER", "DMY")
 | 
			
		||||
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
 | 
			
		||||
FILENAME_PARSE_TRANSFORMS = []
 | 
			
		||||
for t in json.loads(os.getenv("PAPERLESS_FILENAME_PARSE_TRANSFORMS", "[]")):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user