Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
m3_webInterface
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
m3
m3_webInterface
Commits
7446a45e
Commit
7446a45e
authored
Oct 24, 2017
by
Mario Chirinos Colunga
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index speed
parent
d38a524d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
3 deletions
+92
-3
audioList.html
catalog/templates/audioList.html
+77
-0
index.html
catalog/templates/index.html
+1
-1
urls.py
catalog/urls.py
+1
-0
urls.pyc
catalog/urls.pyc
+0
-0
views.py
catalog/views.py
+13
-2
views.pyc
catalog/views.pyc
+0
-0
No files found.
catalog/templates/audioList.html
0 → 100644
View file @
7446a45e
{% extends "base_generic.html" %}
{% load humanize %}
{% block dash-title %}
<b>
{{form.text.value|default:"Fuentes de Información en Audio"|capfirst}}
</b>
{% endblock %}
{% block dash %}
<!-- /.row -->
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
>
Fuentes de Información
</div>
<!-- /.panel-heading -->
<div
class=
"panel-body"
>
<table
width=
"100%"
class=
"table table-striped table-bordered table-hover"
id=
"dataTables-example"
>
<thead>
<tr>
<th>
Nombre
</th>
<th>
ID
</th>
<th>
url
</th>
<th>
Desde
</th>
<th>
Horas
</th>
<th>
Tipo
</th>
</tr>
</thead>
<tbody>
{% for p in publishers %}
<tr
class=
"odd gradeX"
>
<td>
{{p.name}}
</td>
<td>
{{p.shortName}}
</td>
<td><a
href=
"{{p.url}}"
target=
"blank"
>
{{p.url}}
</a></td>
<td>
{{p.date}}
</td>
<td><a
href=
"{% url 'news-list'%}?publishers={{p.id}}&{{queryurl}}"
>
{{p.news|intcomma}}
</a></td>
<td>
{{p.type}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
{% endblock %}
{% block scripts %}
<script>
$
(
document
).
ready
(
function
()
{
$
(
'#dataTables-example'
).
DataTable
({
responsive
:
true
,
"language"
:
{
"url"
:
"/static/languages/Spanish.json"
}
});
});
</script>
{% endblock %}
catalog/templates/index.html
View file @
7446a45e
...
@@ -140,7 +140,7 @@
...
@@ -140,7 +140,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
<a
href=
"{% url '
publishers
-list'%}?{{ request.GET.urlencode }}"
>
<a
href=
"{% url '
audio
-list'%}?{{ request.GET.urlencode }}"
>
<div
class=
"panel-footer"
>
<div
class=
"panel-footer"
>
<span
class=
"pull-left"
>
Ver lista
</span>
<span
class=
"pull-left"
>
Ver lista
</span>
<span
class=
"pull-right"
><i
class=
"fa fa-arrow-circle-right"
></i></span>
<span
class=
"pull-right"
><i
class=
"fa fa-arrow-circle-right"
></i></span>
...
...
catalog/urls.py
View file @
7446a45e
...
@@ -12,6 +12,7 @@ urlpatterns = [
...
@@ -12,6 +12,7 @@ urlpatterns = [
url
(
r'^ws/news/$'
,
views
.
wsNewsList
,
name
=
'ws-news-list'
),
url
(
r'^ws/news/$'
,
views
.
wsNewsList
,
name
=
'ws-news-list'
),
url
(
r'^ws/graphs/$'
,
views
.
wsGraphs
,
name
=
'ws-graphs'
),
url
(
r'^ws/graphs/$'
,
views
.
wsGraphs
,
name
=
'ws-graphs'
),
url
(
r'^ws/download/$'
,
views
.
wsDownloadNews
,
name
=
'ws-download-news'
),
url
(
r'^ws/download/$'
,
views
.
wsDownloadNews
,
name
=
'ws-download-news'
),
url
(
r'^audio/$'
,
views
.
audioList
,
name
=
'audio-list'
),
]
]
catalog/urls.pyc
View file @
7446a45e
No preview for this file type
catalog/views.py
View file @
7446a45e
...
@@ -69,7 +69,7 @@ def index(request):
...
@@ -69,7 +69,7 @@ def index(request):
news
=
getNewsByRequest
(
request
)
news
=
getNewsByRequest
(
request
)
form
=
SearchForm
(
request
.
GET
.
copy
())
form
=
SearchForm
(
request
.
GET
.
copy
())
if
len
(
news
)
>
0
:
if
news
.
count
(
)
>
0
:
if
'startDate'
not
in
form
or
(
'startDate'
in
form
and
form
[
'startDate'
]
.
value
==
""
):
if
'startDate'
not
in
form
or
(
'startDate'
in
form
and
form
[
'startDate'
]
.
value
==
""
):
form
.
data
.
update
({
'startDate'
:
news
.
earliest
(
'date'
)
.
date
.
strftime
(
"
%
Y-
%
m-
%
d"
)})
form
.
data
.
update
({
'startDate'
:
news
.
earliest
(
'date'
)
.
date
.
strftime
(
"
%
Y-
%
m-
%
d"
)})
...
@@ -79,6 +79,7 @@ def index(request):
...
@@ -79,6 +79,7 @@ def index(request):
info
=
dict
()
info
=
dict
()
info
[
'nPublishers'
]
=
news
.
values
(
'publisher'
)
.
distinct
()
.
count
()
info
[
'nPublishers'
]
=
news
.
values
(
'publisher'
)
.
distinct
()
.
count
()
info
[
'nNews'
]
=
news
.
count
()
info
[
'nNews'
]
=
news
.
count
()
info
[
'nAudio'
]
=
Publisher
.
objects
.
all
()
.
filter
(
type
=
"audio"
)
.
count
()
queryset
=
news
.
values
(
"publisher"
)
.
order_by
(
"publisher"
)
.
annotate
(
count
=
Count
(
'publisher'
)
)
queryset
=
news
.
values
(
"publisher"
)
.
order_by
(
"publisher"
)
.
annotate
(
count
=
Count
(
'publisher'
)
)
...
@@ -91,7 +92,7 @@ def index(request):
...
@@ -91,7 +92,7 @@ def index(request):
donutChart
=
[{
"label"
:
Publisher
.
objects
.
get
(
id
=
q
[
'publisher'
])
.
name
,
"value"
:
q
[
"count"
],
"url"
:
urlDict
[
q
[
'publisher'
]]}
for
q
in
queryset
]
donutChart
=
[{
"label"
:
Publisher
.
objects
.
get
(
id
=
q
[
'publisher'
])
.
name
,
"value"
:
q
[
"count"
],
"url"
:
urlDict
[
q
[
'publisher'
]]}
for
q
in
queryset
]
publishers
=
Publisher
.
objects
.
all
()
.
filter
(
Q
(
id__in
=
news
.
values
(
'publisher'
)
.
distinct
()))
publishers
=
Publisher
.
objects
.
all
()
.
filter
(
Q
(
id__in
=
news
.
values
(
'publisher'
)
.
distinct
()))
queryset
=
news
.
values
(
"publisher"
)
.
annotate
(
day
=
TruncMonth
(
'date'
)
)
queryset
=
news
.
values
(
"publisher"
)
.
annotate
(
day
=
TruncMonth
(
'date'
)
)
...
@@ -103,6 +104,7 @@ def index(request):
...
@@ -103,6 +104,7 @@ def index(request):
histogramsData
=
[
{
"date"
:
d
,
"data"
:{
k
:(
dateDicts
[
k
][
d
]
if
d
in
dateDicts
[
k
]
else
0
)
for
k
in
dateDicts
.
keys
()}
}
for
d
in
dateList
]
histogramsData
=
[
{
"date"
:
d
,
"data"
:{
k
:(
dateDicts
[
k
][
d
]
if
d
in
dateDicts
[
k
]
else
0
)
for
k
in
dateDicts
.
keys
()}
}
for
d
in
dateList
]
histogramsLabels
=
[
p
.
shortName
for
p
in
publishers
]
histogramsLabels
=
[
p
.
shortName
for
p
in
publishers
]
# return render(request,'index.html',{"form":form, "info":info, "donutChart":{}, "histogram": {}, "histogramsLabels":{}})
return
render
(
request
,
'index.html'
,{
"form"
:
form
,
"info"
:
info
,
"donutChart"
:
donutChart
,
"histogram"
:
histogramsData
,
"histogramsLabels"
:
histogramsLabels
})
return
render
(
request
,
'index.html'
,{
"form"
:
form
,
"info"
:
info
,
"donutChart"
:
donutChart
,
"histogram"
:
histogramsData
,
"histogramsLabels"
:
histogramsLabels
})
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
def
publisherList
(
request
,
type
=
"all"
):
def
publisherList
(
request
,
type
=
"all"
):
...
@@ -229,3 +231,12 @@ def wsDownloadNews(request):
...
@@ -229,3 +231,12 @@ def wsDownloadNews(request):
response
[
'Content-Disposition'
]
=
'attachment; filename="news_'
+
str
(
int
(
time
.
time
()))
+
'.zip"'
response
[
'Content-Disposition'
]
=
'attachment; filename="news_'
+
str
(
int
(
time
.
time
()))
+
'.zip"'
return
response
return
response
#-------------------------------------------------------------------------------
def
audioList
(
request
):
form
=
SearchForm
(
request
.
GET
)
publishers
=
Publisher
.
objects
.
all
()
.
filter
(
type
=
"audio"
)
return
render
(
request
,
'audioList.html'
,{
"form"
:
form
,
"publishers"
:
publishers
})
catalog/views.pyc
View file @
7446a45e
No preview for this file type
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