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
760fbbb3
Commit
760fbbb3
authored
Jan 03, 2021
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix shelf time_created vs. time_last_modified
parent
56388145
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
shelf.py
cps/shelf.py
+11
-12
No files found.
cps/shelf.py
View file @
760fbbb3
...
@@ -235,23 +235,22 @@ def edit_shelf(shelf_id):
...
@@ -235,23 +235,22 @@ def edit_shelf(shelf_id):
def
create_edit_shelf
(
shelf
,
title
,
page
,
shelf_id
=
False
):
def
create_edit_shelf
(
shelf
,
title
,
page
,
shelf_id
=
False
):
if
request
.
method
==
"POST"
:
if
request
.
method
==
"POST"
:
to_save
=
request
.
form
.
to_dict
()
to_save
=
request
.
form
.
to_dict
()
if
"is_public"
in
to_save
:
shelf
.
is_public
=
1
else
:
shelf
.
is_public
=
0
if
check_shelf_is_unique
(
shelf
,
to_save
,
shelf_id
):
if
check_shelf_is_unique
(
shelf
,
to_save
,
shelf_id
):
if
"is_public"
in
to_save
:
shelf
.
is_public
=
1
else
:
shelf
.
is_public
=
0
shelf
.
name
=
to_save
[
"title"
]
shelf
.
name
=
to_save
[
"title"
]
shelf
.
last_modified
=
datetime
.
utcnow
()
#
shelf.last_modified = datetime.utcnow()
if
not
shelf_id
:
if
not
shelf_id
:
shelf
.
user_id
=
int
(
current_user
.
id
)
shelf
.
user_id
=
int
(
current_user
.
id
)
ub
.
session
.
add
(
shelf
)
shelf_action
=
"created"
flash_text
=
_
(
u"Shelf
%(title)
s created"
,
title
=
to_save
[
"title"
])
else
:
shelf_action
=
"changed"
flash_text
=
_
(
u"Shelf
%(title)
s changed"
,
title
=
to_save
[
"title"
])
try
:
try
:
if
not
shelf_id
:
ub
.
session
.
add
(
shelf
)
shelf_action
=
"created"
flash_text
=
_
(
u"Shelf
%(title)
s created"
,
title
=
to_save
[
"title"
])
else
:
shelf_action
=
"changed"
flash_text
=
_
(
u"Shelf
%(title)
s changed"
,
title
=
to_save
[
"title"
])
ub
.
session
.
commit
()
ub
.
session
.
commit
()
log
.
info
(
u"Shelf {} {}"
.
format
(
to_save
[
"title"
],
shelf_action
))
log
.
info
(
u"Shelf {} {}"
.
format
(
to_save
[
"title"
],
shelf_action
))
flash
(
flash_text
,
category
=
"success"
)
flash
(
flash_text
,
category
=
"success"
)
...
...
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