fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
General A/B testing.
[wolnelektury.git]
/
src
/
catalogue
/
api
/
fields.py
diff --git
a/src/catalogue/api/fields.py
b/src/catalogue/api/fields.py
index
48c0095
..
80de4ab
100644
(file)
--- a/
src/catalogue/api/fields.py
+++ b/
src/catalogue/api/fields.py
@@
-14,7
+14,7
@@
class BookLiked(serializers.ReadOnlyField):
def to_representation(self, value):
request = self.context['request']
if not hasattr(request, 'liked_books'):
def to_representation(self, value):
request = self.context['request']
if not hasattr(request, 'liked_books'):
- if request.user.is_authenticated
()
:
+ if request.user.is_authenticated:
request.liked_books = set(Book.tagged.with_any(request.user.tag_set.all()).values_list('id', flat=True))
else:
request.liked_books = None
request.liked_books = set(Book.tagged.with_any(request.user.tag_set.all()).values_list('id', flat=True))
else:
request.liked_books = None
@@
-25,7
+25,8
@@
class BookLiked(serializers.ReadOnlyField):
class EmbargoURLField(AbsoluteURLField):
def to_representation(self, value):
request = self.context['request']
class EmbargoURLField(AbsoluteURLField):
def to_representation(self, value):
request = self.context['request']
- if Membership.is_active_for(request.user):
+ # FIXME: See #3955.
+ if True or Membership.is_active_for(request.user):
return super().to_representation(value)
else:
return None
return super().to_representation(value)
else:
return None