fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6f313f2
)
redirect to gallery for single tags with no book results
author
Jan Szejko
<jan.szejko@gmail.com>
Wed, 13 Apr 2016 11:07:54 +0000
(13:07 +0200)
committer
Jan Szejko
<jan.szejko@gmail.com>
Wed, 13 Apr 2016 11:07:54 +0000
(13:07 +0200)
src/catalogue/views.py
patch
|
blob
|
history
diff --git
a/src/catalogue/views.py
b/src/catalogue/views.py
index
1955137
..
81d0a02
100644
(file)
--- a/
src/catalogue/views.py
+++ b/
src/catalogue/views.py
@@
-108,6
+108,11
@@
def object_list(request, objects, fragments=None, related_tags=None, tags=None,
categories = split_tags(*related_tag_lists)
objects = list(objects)
categories = split_tags(*related_tag_lists)
objects = list(objects)
+
+ if not objects and len(tags) == 1 and list_type == 'books':
+ if PictureArea.tagged.with_any(tags).exists() or Picture.tagged.with_any(tags).exists():
+ return redirect('tagged_object_list_gallery', '/'.join(tag.url_chunk for tag in tags))
+
if len(objects) > 3:
best = random.sample(objects, 3)
else:
if len(objects) > 3:
best = random.sample(objects, 3)
else:
@@
-201,10
+206,7
@@
def theme_list(request, tags, list_type):
fragments = fragments.filter(Q(book__in=books) | Q(book__ancestor__in=books))
if not fragments and len(tags) == 1 and list_type == 'books':
fragments = fragments.filter(Q(book__in=books) | Q(book__ancestor__in=books))
if not fragments and len(tags) == 1 and list_type == 'books':
- tag = tags[0]
- if tag.category == 'theme' and (
- PictureArea.tagged.with_any([tag]).exists() or
- Picture.tagged.with_any([tag]).exists()):
+ if PictureArea.tagged.with_any(tags).exists() or Picture.tagged.with_any(tags).exists():
return redirect('tagged_object_list_gallery', '/'.join(tag.url_chunk for tag in tags))
return object_list(request, fragments, tags=tags, list_type=list_type, extra={
return redirect('tagged_object_list_gallery', '/'.join(tag.url_chunk for tag in tags))
return object_list(request, fragments, tags=tags, list_type=list_type, extra={