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
33bd5670
Commit
33bd5670
authored
Jul 09, 2024
by
impfundev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: total category on dashboard summary
parent
34511b04
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
views.py
dashboards/views.py
+3
-1
No files found.
dashboards/views.py
View file @
33bd5670
from
django.db.models
import
Q
from
django.views.generic
import
ListView
,
TemplateView
from
django.shortcuts
import
render
from
datetime
import
datetime
,
timedelta
from
librarians.models
import
LoginHistory
from
members.models
import
Members
from
book_loans.models
import
Book
,
BookLoans
from
categories.models
import
Category
class
OverduedLoanView
(
ListView
):
...
...
@@ -84,6 +84,7 @@ class DashboardView(TemplateView):
login_history
=
LoginHistory
.
objects
.
order_by
(
"-login_at"
)[:
10
]
book_loans
=
BookLoans
.
objects
.
all
()
total_book
=
Book
.
objects
.
count
()
total_category
=
Category
.
objects
.
count
()
total_member
=
Members
.
objects
.
count
()
total_book_loans
=
book_loans
.
count
()
...
...
@@ -104,6 +105,7 @@ class DashboardView(TemplateView):
context
[
"login_histories"
]
=
self
.
login_history
context
[
"total_book"
]
=
self
.
total_book
context
[
"total_category"
]
=
self
.
total_category
context
[
"total_member"
]
=
self
.
total_member
context
[
"total_book_loans"
]
=
self
.
total_book_loans
context
[
"total_overdue"
]
=
overdue_loans
.
count
()
...
...
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