fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add mock Search class for development.
[wolnelektury.git]
/
apps
/
social
/
utils.py
diff --git
a/apps/social/utils.py
b/apps/social/utils.py
index
00cf43e
..
c6a9353
100755
(executable)
--- a/
apps/social/utils.py
+++ b/
apps/social/utils.py
@@
-1,3
+1,7
@@
+# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from django.db.models import Q
from catalogue.models import Book, Tag
from catalogue import utils
from django.db.models import Q
from catalogue.models import Book, Tag
from catalogue import utils
@@
-33,11
+37,9
@@
def set_sets(user, work, sets):
touch_tag(shelf)
# delete empty tags
touch_tag(shelf)
# delete empty tags
- Tag.objects.filter(category='set', user=user,
book_count=0
).delete()
+ Tag.objects.filter(category='set', user=user,
items=None
).delete()
def cites_for_tags(tags):
"""Returns a QuerySet with all Cites for books with given tags."""
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)
+ return Cite.objects.filter(book__in=Book.tagged.with_all(tags))