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
0ab1253c
Commit
0ab1253c
authored
Nov 16, 2022
by
Mario Chirinos
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into dev
parents
5ac0ea28
587bbc9d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
8 deletions
+28
-8
updateDB.py
catalog/management/commands/updateDB.py
+26
-6
base_generic_top.html
catalog/templates/base_generic_top.html
+1
-1
index.html
catalog/templates/new/index.html
+1
-1
No files found.
catalog/management/commands/updateDB.py
View file @
0ab1253c
...
...
@@ -2,6 +2,7 @@ from django.core.management.base import BaseCommand, CommandError
from
catalog.models
import
News
,
Publisher
,
Topic
,
audioTime
from
django.db.models
import
Q
import
os
import
glob
import
json
import
datetime
from
django.utils
import
timezone
...
...
@@ -51,12 +52,30 @@ class Command(BaseCommand):
audioTime
.
objects
.
update_or_create
(
publisher
=
p
,
defaults
=
{
'minutes'
:
minutes
,
"startDate"
:
since
,
"endDate"
:
endDate
},)
#load news
os
.
chdir
(
options
[
'basedir'
][
0
])
publisherList
=
os
.
listdir
(
options
[
'basedir'
][
0
])
publisherList
=
[
i
for
i
in
os
.
listdir
(
options
[
'basedir'
][
0
])
if
os
.
path
.
isdir
(
i
)
]
for
p
in
publisherList
:
print
(
p
)
curentdir
=
options
[
'basedir'
][
0
]
+
p
+
"/"
os
.
chdir
(
curentdir
)
publisher
=
Publisher
.
objects
.
all
()
.
filter
(
shortName
=
p
)
print
(
os
.
getcwd
())
if
publisher
.
count
()
<=
0
and
os
.
path
.
isfile
(
"settings.json"
)
:
print
(
p
,
"do not exsist, crating publisher"
)
with
open
(
'settings.json'
,
'r'
)
as
f
:
cfgfile
=
json
.
load
(
f
)
newPublisher
=
Publisher
()
newPublisher
.
shortName
=
p
newPublisher
.
name
=
cfgfile
[
"name"
]
newPublisher
.
crawler
=
cfgfile
[
"crawler"
]
newPublisher
.
url
=
cfgfile
[
"url"
]
newPublisher
.
type
=
"texto"
newPublisher
.
save
()
publisher
=
Publisher
.
objects
.
all
()
.
filter
(
shortName
=
p
)
publisher
=
publisher
[
0
]
os
.
chdir
(
p
)
publisher
=
Publisher
.
objects
.
all
()
.
filter
(
shortName
=
p
)[
0
]
news
=
News
.
objects
.
all
()
.
filter
(
publisher
=
publisher
.
id
)
.
order_by
(
"-date"
)
minYear
=
0
lastDate
=
datetime
.
datetime
(
1950
,
1
,
1
)
...
...
@@ -64,14 +83,15 @@ class Command(BaseCommand):
if
news
.
count
()
>
0
:
minYear
=
news
[
0
]
.
date
.
year
lastDate
=
news
[
0
]
.
date
yearList
=
sorted
([
int
(
y
)
for
y
in
os
.
listdir
(
'.'
)])
yearList
=
sorted
([
int
(
y
)
for
y
in
os
.
listdir
(
'.'
)
if
os
.
path
.
isdir
(
y
)
])
print
(
yearList
)
for
y
in
sorted
(
yearList
):
if
y
>=
minYear
:
os
.
chdir
(
str
(
y
))
print
(
os
.
getcwd
())
filesList
=
sorted
(
os
.
listdir
(
"."
))
#filesList = sorted(os.listdir("."))
filesList
=
sorted
(
glob
.
glob
(
"*.json"
))
print
(
filesList
)
for
f
in
filesList
:
fileDate
=
datetime
.
datetime
.
strptime
(
f
[:
f
.
find
(
"."
)],
"
%
Y-
%
m-
%
d"
)
.
date
()
...
...
catalog/templates/base_generic_top.html
View file @
0ab1253c
...
...
@@ -12,7 +12,7 @@
<link
rel=
"icon"
href=
"{% static 'images/m3.png' %}"
>
<title>
Monitoreo de Multiples Medios
</title>
{% load static
files
%}
{% load static %}
<script
type=
"text/javascript"
src=
"{% static 'static_jquery/js/jquery.js' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'admin/js/jquery.init.js' %}"
></script>
<link
rel=
"stylesheet"
href=
"{% static 'css/forms.css' %}"
>
...
...
catalog/templates/new/index.html
View file @
0ab1253c
{% extends "new/adminLTE2_base.html" %}
{% load static
files
%}
{% load static %}
{% load humanize %}
{% block headMedia %}
<!-- Morris chart -->
...
...
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