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
b6da3c31
Commit
b6da3c31
authored
Mar 02, 2017
by
Jack Darlington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for read/unread for anonymous users
parent
fb6a37ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
detail.html
cps/templates/detail.html
+2
-0
web.py
cps/web.py
+5
-2
No files found.
cps/templates/detail.html
View file @
b6da3c31
...
...
@@ -107,6 +107,7 @@
</div>
</p>
{% endif %}
{% if not g.user.is_anonymous() %}
<p>
<div
class=
"custom_columns"
id=
"have_read"
>
Read
...
...
@@ -119,6 +120,7 @@
</form>
</div>
</p>
{% endif %}
{% if entry.comments|length > 0 and entry.comments[0].text|length > 0%}
...
...
cps/web.py
View file @
b6da3c31
...
...
@@ -1141,9 +1141,12 @@ def show_book(id):
#return render_title_template('detail.html', entry=entries, cc=cc,
# title=entries.title, books_shelfs=book_in_shelfs)
matching_have_read_book
=
ub
.
session
.
query
(
ub
.
ReadBook
)
.
filter
(
ub
.
and_
(
ub
.
ReadBook
.
user_id
==
int
(
current_user
.
id
),
if
not
current_user
.
is_anonymous
():
matching_have_read_book
=
ub
.
session
.
query
(
ub
.
ReadBook
)
.
filter
(
ub
.
and_
(
ub
.
ReadBook
.
user_id
==
int
(
current_user
.
id
),
ub
.
ReadBook
.
book_id
==
id
))
.
all
()
have_read
=
len
(
matching_have_read_book
)
>
0
and
matching_have_read_book
[
0
]
.
is_read
have_read
=
len
(
matching_have_read_book
)
>
0
and
matching_have_read_book
[
0
]
.
is_read
else
:
have_read
=
None
return
render_title_template
(
'detail.html'
,
entry
=
entries
,
cc
=
cc
,
title
=
entries
.
title
,
books_shelfs
=
book_in_shelfs
,
have_read
=
have_read
)
...
...
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