fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix child book reimport bugs.
[wolnelektury.git]
/
apps
/
social
/
utils.py
diff --git
a/apps/social/utils.py
b/apps/social/utils.py
index
96f0ca0
..
00cf43e
100755
(executable)
--- a/
apps/social/utils.py
+++ b/
apps/social/utils.py
@@
-1,7
+1,8
@@
from django.db.models import Q
from django.db.models import Q
-from catalogue.models import Tag
+from catalogue.models import
Book,
Tag
from catalogue import utils
from catalogue.tasks import touch_tag
from catalogue import utils
from catalogue.tasks import touch_tag
+from social.models import Cite
def likes(user, work):
def likes(user, work):
@@
-33,3
+34,10
@@
def set_sets(user, work, sets):
# delete empty tags
Tag.objects.filter(category='set', user=user, book_count=0).delete()
# delete empty tags
Tag.objects.filter(category='set', user=user, book_count=0).delete()
+
+
+def cites_for_tags(tags):
+ """Returns a QuerySet with all Cites for books with given tags."""
+ books = Book.tagged.with_all(tags).order_by().values_list('id', flat=True)
+ books = list(books)
+ return Cite.objects.filter(book__id__in=books)