fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
main.scss
[wolnelektury.git]
/
src
/
social
/
utils.py
diff --git
a/src/social/utils.py
b/src/social/utils.py
index
bf1c242
..
c89878a
100755
(executable)
--- a/
src/social/utils.py
+++ b/
src/social/utils.py
@@
-21,7
+21,7
@@
def likes(user, work, request=None):
if not hasattr(request, 'social_likes'):
# tuple: unchecked, checked, liked
if not hasattr(request, 'social_likes'):
# tuple: unchecked, checked, liked
- request.social_likes = defaultdict(lambda:(set(), set(), set()))
+ request.social_likes = defaultdict(lambda:
(set(), set(), set()))
ct = ContentType.objects.get_for_model(type(work))
likes_t = request.social_likes[ct.pk]
ct = ContentType.objects.get_for_model(type(work))
likes_t = request.social_likes[ct.pk]
@@
-29,6
+29,7
@@
def likes(user, work, request=None):
return work.pk in likes_t[2]
else:
likes_t[0].add(work.pk)
return work.pk in likes_t[2]
else:
likes_t[0].add(work.pk)
+
def _likes():
if likes_t[0]:
ids = tuple(likes_t[0])
def _likes():
if likes_t[0]:
ids = tuple(likes_t[0])
@@
-47,8
+48,8
@@
def get_set(user, name):
try:
tag = Tag.objects.get(category='set', user=user, name=name)
except Tag.DoesNotExist:
try:
tag = Tag.objects.get(category='set', user=user, name=name)
except Tag.DoesNotExist:
- tag = Tag.objects.create(
category='set', user=user, name=name,
-
slug=utils.get_random_hash(name), sort_key=name.lower())
+ tag = Tag.objects.create(
+
category='set', user=user, name=name,
slug=utils.get_random_hash(name), sort_key=name.lower())
return tag
return tag