Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
6a550913
Commit
6a550913
authored
Feb 27, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard
parent
4b26ed3c
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
198 additions
and
8 deletions
+198
-8
dashboard.html
administration/templates/dashboard.html
+170
-2
views.py
administration/views.py
+28
-6
No files found.
administration/templates/dashboard.html
View file @
6a550913
This diff is collapsed.
Click to expand it.
administration/views.py
View file @
6a550913
import
calendar
from
django.contrib
import
messages
from
django.contrib
import
messages
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.db.models
import
Count
from
django.db.models
import
Count
...
@@ -8,7 +10,7 @@ from PIL import Image
...
@@ -8,7 +10,7 @@ from PIL import Image
# Create your views here.
# Create your views here.
from
catalog.models
import
Purchase
from
catalog.models
import
Purchase
,
Search
def
Dashboard
(
request
):
def
Dashboard
(
request
):
...
@@ -17,11 +19,31 @@ def Dashboard(request):
...
@@ -17,11 +19,31 @@ def Dashboard(request):
Request
=
User
.
objects
.
filter
(
is_active
=
False
)
.
count
()
Request
=
User
.
objects
.
filter
(
is_active
=
False
)
.
count
()
in_process
=
Purchase
.
objects
.
filter
(
purchased
=
True
)
.
exclude
(
progress
=
100
)
.
count
()
in_process
=
Purchase
.
objects
.
filter
(
purchased
=
True
)
.
exclude
(
progress
=
100
)
.
count
()
month_lst
=
[
{
'quantity'
:
0
,
'date'
:
'January'
},
{
'quantity'
:
0
,
'date'
:
'February'
},
{
'quantity'
:
0
,
'date'
:
'March'
},
return
render
(
request
,
'dashboard.html'
,
{
"Viewname"
:
"Dashboard"
,
"Usuarios"
:
usuarios
,
"Total_compras"
:
total
,
"Solicitud"
:
Request
,
"Descargando"
:
in_process
})
{
'quantity'
:
0
,
'date'
:
'April'
},
{
'quantity'
:
0
,
'date'
:
'May'
},
{
'quantity'
:
0
,
'date'
:
'June'
},
{
'quantity'
:
0
,
'date'
:
'July'
},
{
'quantity'
:
0
,
'date'
:
'August'
},
{
'quantity'
:
0
,
'date'
:
'September'
},
{
'quantity'
:
0
,
'date'
:
'October'
},
{
'quantity'
:
0
,
'date'
:
'November'
},
{
'quantity'
:
0
,
'date'
:
'December'
}]
for
date
in
Purchase
.
objects
.
filter
()
.
extra
({
'month'
:
"Extract(month from aggreg_date)"
})
.
values_list
(
'month'
)
.
annotate
(
Count
(
'id'
)):
date_name
=
calendar
.
month_name
[
int
(
date
[
0
])]
for
month
in
month_lst
:
if
month
[
'date'
]
==
date_name
:
month
[
'quantity'
]
=
date
[
1
]
Searches
=
Search
.
objects
.
values
(
'area'
)
.
annotate
(
count
=
Count
(
'area'
))
.
order_by
(
'-count'
)[:
5
]
return
render
(
request
,
'dashboard.html'
,
{
"Viewname"
:
"Dashboard"
,
"Usuarios"
:
usuarios
,
"Total_compras"
:
total
,
"Solicitud"
:
Request
,
"Descargando"
:
in_process
,
"dates"
:
month_lst
,
"search"
:
Searches
})
# ----------------------------------------------------------
# ----------------------------------------------------------
...
...
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