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
8ad84a7c
Commit
8ad84a7c
authored
Jan 02, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #1123 (mature content is visible in shelfs)
parent
32e818af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
+7
-13
shelf.py
cps/shelf.py
+7
-13
No files found.
cps/shelf.py
View file @
8ad84a7c
...
@@ -30,6 +30,7 @@ from sqlalchemy.sql.expression import func, or_, and_
...
@@ -30,6 +30,7 @@ from sqlalchemy.sql.expression import func, or_, and_
from
.
import
logger
,
ub
,
searched_ids
,
db
from
.
import
logger
,
ub
,
searched_ids
,
db
from
.web
import
render_title_template
from
.web
import
render_title_template
from
.helper
import
common_filters
shelf
=
Blueprint
(
'shelf'
,
__name__
)
shelf
=
Blueprint
(
'shelf'
,
__name__
)
...
@@ -281,16 +282,10 @@ def show_shelf(shelf_type, shelf_id):
...
@@ -281,16 +282,10 @@ def show_shelf(shelf_type, shelf_id):
if
shelf
:
if
shelf
:
page
=
"shelf.html"
if
shelf_type
==
1
else
'shelfdown.html'
page
=
"shelf.html"
if
shelf_type
==
1
else
'shelfdown.html'
books_in_shelf
=
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
shelf
==
shelf_id
)
.
order_by
(
books_in_shelf
=
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
shelf
==
shelf_id
)
\
ub
.
BookShelf
.
order
.
asc
())
.
all
()
.
order_by
(
ub
.
BookShelf
.
order
.
asc
())
.
all
()
for
book
in
books_in_shelf
:
books_list
=
[
b
.
book_id
for
b
in
books_in_shelf
]
cur_book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book
.
book_id
)
.
first
()
result
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
.
in_
(
books_list
))
.
filter
(
common_filters
())
.
all
()
if
cur_book
:
result
.
append
(
cur_book
)
else
:
log
.
info
(
'Not existing book
%
s in
%
s deleted'
,
book
.
book_id
,
shelf
)
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
book_id
==
book
.
book_id
)
.
delete
()
ub
.
session
.
commit
()
return
render_title_template
(
page
,
entries
=
result
,
title
=
_
(
u"Shelf: '
%(name)
s'"
,
name
=
shelf
.
name
),
return
render_title_template
(
page
,
entries
=
result
,
title
=
_
(
u"Shelf: '
%(name)
s'"
,
name
=
shelf
.
name
),
shelf
=
shelf
,
page
=
"shelf"
)
shelf
=
shelf
,
page
=
"shelf"
)
else
:
else
:
...
@@ -322,9 +317,8 @@ def order_shelf(shelf_id):
...
@@ -322,9 +317,8 @@ def order_shelf(shelf_id):
if
shelf
:
if
shelf
:
books_in_shelf2
=
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
shelf
==
shelf_id
)
\
books_in_shelf2
=
ub
.
session
.
query
(
ub
.
BookShelf
)
.
filter
(
ub
.
BookShelf
.
shelf
==
shelf_id
)
\
.
order_by
(
ub
.
BookShelf
.
order
.
asc
())
.
all
()
.
order_by
(
ub
.
BookShelf
.
order
.
asc
())
.
all
()
for
book
in
books_in_shelf2
:
books_list
=
[
b
.
book_id
for
b
in
books_in_shelf2
]
cur_book
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
==
book
.
book_id
)
.
first
()
result
=
db
.
session
.
query
(
db
.
Books
)
.
filter
(
db
.
Books
.
id
.
in_
(
books_list
))
.
filter
(
common_filters
())
.
all
()
result
.
append
(
cur_book
)
return
render_title_template
(
'shelf_order.html'
,
entries
=
result
,
return
render_title_template
(
'shelf_order.html'
,
entries
=
result
,
title
=
_
(
u"Change order of Shelf: '
%(name)
s'"
,
name
=
shelf
.
name
),
title
=
_
(
u"Change order of Shelf: '
%(name)
s'"
,
name
=
shelf
.
name
),
shelf
=
shelf
,
page
=
"shelforder"
)
shelf
=
shelf
,
page
=
"shelforder"
)
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