Commit c15e818 1 parent 19bafd5 commit c15e818 Copy full SHA for c15e818
File tree 3 files changed +13
-5
lines changed
fragdenstaat_de/fds_paperless
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -31,13 +31,14 @@ def get_document_data(paperless_document_id):
31
31
return meta_data , file_data
32
32
33
33
34
- def list_documents ():
34
+ def list_documents (week = 1 ):
35
35
client = get_paperless_client ()
36
- last_week = timezone .now () - timedelta (days = 7 )
36
+ older_than = timezone .now () - timedelta (days = 7 * week )
37
+ younger_than = older_than + timedelta (days = 8 )
37
38
API_URL = (
38
39
settings .PAPERLESS_API_URL
39
- + "/documents/?added__date__gt={}&document_type__isnull=1" .format (
40
- last_week .date ()
40
+ + "/documents/?added__date__lt={}& added__date__gt={}&document_type__isnull=1" .format (
41
+ younger_than . date (), older_than .date ()
41
42
)
42
43
)
43
44
Original file line number Diff line number Diff line change @@ -39,4 +39,6 @@ <h1>{% trans "Choose documents to import" %}</h1>
39
39
{% endfor %}
40
40
</ ul >
41
41
</ form >
42
+ < a href ="{% url "paperless_list " %}?week={{ week|add: "1" }}"
43
+ class="btn btn-secondary "> {% translate "Load week before" %}</ a >
42
44
{% endblock app_body %}
Original file line number Diff line number Diff line change 15
15
16
16
@require_crew
17
17
def list_view (request ):
18
- paperless_docs = list_documents ()
18
+ try :
19
+ week = max (int (request .GET .get ("week" , 1 )), 1 )
20
+ except ValueError :
21
+ week = 1
22
+ paperless_docs = list_documents (week = week )
19
23
return render (
20
24
request ,
21
25
"fds_paperless/list_documents.html" ,
22
26
{
23
27
"documents" : paperless_docs ,
28
+ "week" : week ,
24
29
},
25
30
)
26
31
You can’t perform that action at this time.
0 commit comments