Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
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
captainwong
douban-api-proxy
Commits
827b0c6e
Commit
827b0c6e
authored
Jun 06, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed pubdate to timestamp
parent
d1b53384
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
10 deletions
+6
-10
db.py
cps/db.py
+1
-1
jinjia.py
cps/jinjia.py
+3
-7
detail.html
cps/templates/detail.html
+1
-1
ub.py
cps/ub.py
+1
-1
No files found.
cps/db.py
View file @
827b0c6e
...
...
@@ -269,7 +269,7 @@ class Books(Base):
sort
=
Column
(
String
(
collation
=
'NOCASE'
))
author_sort
=
Column
(
String
(
collation
=
'NOCASE'
))
timestamp
=
Column
(
TIMESTAMP
,
default
=
datetime
.
utcnow
)
pubdate
=
Column
(
String
)
# , default=datetime.utcnow
)
pubdate
=
Column
(
TIMESTAMP
,
default
=
DEFAULT_PUBDATE
)
series_index
=
Column
(
String
,
nullable
=
False
,
default
=
"1.0"
)
last_modified
=
Column
(
TIMESTAMP
,
default
=
datetime
.
utcnow
)
path
=
Column
(
String
,
default
=
""
,
nullable
=
False
)
...
...
cps/jinjia.py
View file @
827b0c6e
...
...
@@ -76,22 +76,18 @@ def mimetype_filter(val):
@
jinjia
.
app_template_filter
(
'formatdate'
)
def
formatdate_filter
(
val
):
try
:
conformed_timestamp
=
re
.
sub
(
r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))"
,
''
,
val
)
formatdate
=
datetime
.
datetime
.
strptime
(
conformed_timestamp
[:
15
],
"
%
Y
%
m
%
d
%
H
%
M
%
S"
)
return
format_date
(
formatdate
,
format
=
'medium'
,
locale
=
get_locale
())
return
format_date
(
val
,
format
=
'medium'
,
locale
=
get_locale
())
except
AttributeError
as
e
:
log
.
error
(
'Babel error:
%
s, Current user locale:
%
s, Current User:
%
s'
,
e
,
current_user
.
locale
,
current_user
.
nickname
)
return
formatdate
return
val
@
jinjia
.
app_template_filter
(
'formatdateinput'
)
def
format_date_input
(
val
):
conformed_timestamp
=
re
.
sub
(
r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))"
,
''
,
val
)
date_obj
=
datetime
.
datetime
.
strptime
(
conformed_timestamp
[:
15
],
"
%
Y
%
m
%
d
%
H
%
M
%
S"
)
input_date
=
date_obj
.
isoformat
()
.
split
(
'T'
,
1
)[
0
]
# Hack to support dates <1900
input_date
=
val
.
isoformat
()
.
split
(
'T'
,
1
)[
0
]
# Hack to support dates <1900
return
''
if
input_date
==
"0101-01-01"
else
input_date
...
...
cps/templates/detail.html
View file @
827b0c6e
...
...
@@ -160,7 +160,7 @@
</div>
{% endif %}
{% if
entry.pubdate
[:10] != '0101-01-01' %}
{% if
(entry.pubdate|string)
[:10] != '0101-01-01' %}
<div
class=
"publishing-date"
>
<p>
{{_('Published')}}: {{entry.pubdate|formatdate}}
</p>
</div>
...
...
cps/ub.py
View file @
827b0c6e
...
...
@@ -109,7 +109,7 @@ def get_sidebar_config(kwargs=None):
"visibility"
:
constants
.
SIDEBAR_ARCHIVED
,
'public'
:
(
not
g
.
user
.
is_anonymous
),
"page"
:
"archived"
,
"show_text"
:
_
(
'Show archived books'
),
"config_show"
:
content
})
sidebar
.
append
(
{
"glyph"
:
"glyphicon-th-list"
,
"text"
:
_
(
'Books List'
),
"link"
:
'web.books_
list
'
,
"id"
:
"list"
,
{
"glyph"
:
"glyphicon-th-list"
,
"text"
:
_
(
'Books List'
),
"link"
:
'web.books_
table
'
,
"id"
:
"list"
,
"visibility"
:
constants
.
SIDEBAR_LIST
,
'public'
:
(
not
g
.
user
.
is_anonymous
),
"page"
:
"list"
,
"show_text"
:
_
(
'Show Books List'
),
"config_show"
:
content
})
...
...
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