Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
library-app-django
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ilham Maulana
library-app-django
Commits
ab59db25
Commit
ab59db25
authored
Jul 02, 2024
by
impfundev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: empty book loan
parent
76383d43
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
16 deletions
+20
-16
asgi.py
config/asgi.py
+2
-1
wsgi.py
config/wsgi.py
+3
-1
near_overdue_loan.html
dashboards/templates/dashboard/near_overdue_loan.html
+2
-2
overdue_loan.html
dashboards/templates/dashboard/overdue_loan.html
+2
-2
views.py
dashboards/views.py
+11
-10
No files found.
config/asgi.py
View file @
ab59db25
...
@@ -13,4 +13,5 @@ from django.core.asgi import get_asgi_application
...
@@ -13,4 +13,5 @@ from django.core.asgi import get_asgi_application
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"config.settings"
)
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"config.settings"
)
app
=
get_asgi_application
()
application
=
get_asgi_application
()
app
=
application
config/wsgi.py
View file @
ab59db25
...
@@ -13,4 +13,6 @@ from django.core.wsgi import get_wsgi_application
...
@@ -13,4 +13,6 @@ from django.core.wsgi import get_wsgi_application
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"config.settings"
)
os
.
environ
.
setdefault
(
"DJANGO_SETTINGS_MODULE"
,
"config.settings"
)
app
=
get_wsgi_application
()
application
=
get_wsgi_application
()
app
=
application
dashboards/templates/dashboard/near_overdue_loan.html
View file @
ab59db25
...
@@ -12,13 +12,13 @@
...
@@ -12,13 +12,13 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{% for loan in near_overdue_loans %}
{%
if near_overdue_loans %} {%
for loan in near_overdue_loans %}
<tr>
<tr>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.due_date }}
</td>
<td>
{{ loan.due_date }}
</td>
<td>
{{ loan.loan_date }}
</td>
<td>
{{ loan.loan_date }}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
{% endif %}
</tbody>
</tbody>
</table>
</table>
</div>
</div>
dashboards/templates/dashboard/overdue_loan.html
View file @
ab59db25
...
@@ -10,12 +10,12 @@
...
@@ -10,12 +10,12 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{% for loan in overdue_loans %}
{%
if overdue_loans %} {%
for loan in overdue_loans %}
<tr>
<tr>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.due_date }}
</td>
<td>
{{ loan.due_date }}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
{% endif %}
</tbody>
</tbody>
</table>
</table>
</div>
</div>
dashboards/views.py
View file @
ab59db25
...
@@ -18,22 +18,23 @@ def index(request):
...
@@ -18,22 +18,23 @@ def index(request):
now
=
datetime
.
now
()
now
=
datetime
.
now
()
overdue_loans
=
BookLoans
.
objects
.
filter
(
due_date__lte
=
now
)
overdue_loans
=
BookLoans
.
objects
.
filter
(
due_date__lte
=
now
)
for
loan
in
BookLoans
.
objects
.
all
():
near_overdue_window
=
loan
.
due_date
-
timedelta
(
days
=
7
)
due_date
=
loan
.
due_date
near_overdue_loans
=
BookLoans
.
objects
.
filter
(
due_date__range
=
(
near_overdue_window
,
due_date
)
)
context
=
{
context
=
{
"login_histories"
:
latest_login_history
,
"login_histories"
:
latest_login_history
,
"total_book"
:
total_book
,
"total_book"
:
total_book
,
"total_member"
:
total_member
,
"total_member"
:
total_member
,
"total_book_loans"
:
total_book_loans
,
"total_book_loans"
:
total_book_loans
,
"total_overdue"
:
overdue_loans
.
count
(),
"total_overdue"
:
overdue_loans
.
count
(),
"overdue_loans"
:
overdue_loans
,
"near_overdue_loans"
:
near_overdue_loans
,
}
}
if
overdue_loans
.
exists
():
context
[
"overdue_loans"
]
=
overdue_loans
for
loan
in
BookLoans
.
objects
.
all
():
near_overdue_window
=
loan
.
due_date
-
timedelta
(
days
=
7
)
due_date
=
loan
.
due_date
near_overdue_loans
=
BookLoans
.
objects
.
filter
(
due_date__range
=
(
near_overdue_window
,
due_date
)
)
context
[
"near_overdue_loans"
]
=
near_overdue_loans
return
render
(
request
,
"dashboard/index.html"
,
context
)
return
render
(
request
,
"dashboard/index.html"
,
context
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment