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
d979ed89
Commit
d979ed89
authored
Mar 28, 2016
by
Cervinko Cera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for editing Authors
parent
34cd613e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
db.py
cps/db.py
+1
-1
web.py
cps/web.py
+14
-1
No files found.
cps/db.py
View file @
d979ed89
...
@@ -88,7 +88,7 @@ class Authors(Base):
...
@@ -88,7 +88,7 @@ class Authors(Base):
def
__init__
(
self
,
name
,
sort
,
link
):
def
__init__
(
self
,
name
,
sort
,
link
):
self
.
name
=
name
self
.
name
=
name
self
.
sort
=
sort
self
.
sort
=
sort
self
.
sort
=
link
self
.
link
=
link
def
__repr__
(
self
):
def
__repr__
(
self
):
return
u"<Authors('{0},{1}{2}')>"
.
format
(
self
.
name
,
self
.
sort
,
self
.
link
)
return
u"<Authors('{0},{1}{2}')>"
.
format
(
self
.
name
,
self
.
sort
,
self
.
link
)
...
...
cps/web.py
View file @
d979ed89
...
@@ -662,7 +662,20 @@ def edit_book(book_id):
...
@@ -662,7 +662,20 @@ def edit_book(book_id):
to_save
=
request
.
form
.
to_dict
()
to_save
=
request
.
form
.
to_dict
()
#print to_save
#print to_save
book
.
title
=
to_save
[
"book_title"
]
book
.
title
=
to_save
[
"book_title"
]
book
.
authors
[
0
]
.
name
=
to_save
[
"author_name"
]
is_author
=
db
.
session
.
query
(
db
.
Authors
)
.
filter
(
db
.
Authors
.
name
.
like
(
'
%
'
+
to_save
[
"author_name"
]
.
strip
()
+
'
%
'
))
.
first
()
if
book
.
authors
[
0
]
.
name
not
in
(
"Unknown"
,
"Unbekannt"
,
""
,
" "
):
if
is_author
:
book
.
authors
.
append
(
is_author
)
book
.
authors
.
remove
(
db
.
session
.
query
(
db
.
Authors
)
.
get
(
book
.
authors
[
0
]
.
id
))
else
:
book
.
authors
[
0
]
.
name
=
to_save
[
"author_name"
]
.
strip
()
else
:
if
is_author
:
book
.
authors
.
append
(
is_author
)
else
:
book
.
authors
.
append
(
db
.
Authors
(
to_save
[
"author_name"
]
.
strip
(),
""
,
""
))
book
.
authors
.
remove
(
db
.
session
.
query
(
db
.
Authors
)
.
get
(
book
.
authors
[
0
]
.
id
))
if
to_save
[
"cover_url"
]
and
os
.
path
.
splitext
(
to_save
[
"cover_url"
])[
1
]
.
lower
()
==
".jpg"
:
if
to_save
[
"cover_url"
]
and
os
.
path
.
splitext
(
to_save
[
"cover_url"
])[
1
]
.
lower
()
==
".jpg"
:
img
=
requests
.
get
(
to_save
[
"cover_url"
])
img
=
requests
.
get
(
to_save
[
"cover_url"
])
...
...
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