From: Jan Szejko Date: Fri, 23 Feb 2018 11:30:42 +0000 (+0100) Subject: no ssi for picture short X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/6cc6ca1a2aaf47a116807c53c6a69e6e580bc599 no ssi for picture short --- diff --git a/src/picture/models.py b/src/picture/models.py index 7732e2042..47af34e26 100644 --- a/src/picture/models.py +++ b/src/picture/models.py @@ -14,6 +14,7 @@ from fnpdjango.utils.text.slughifi import slughifi from ssify import flush_ssi_includes from catalogue.models.tag import prefetched_relations +from catalogue.utils import split_tags from picture import tasks from StringIO import StringIO import jsonfield @@ -139,6 +140,9 @@ class Picture(models.Model): def author_unicode(self): return self.tag_unicode('author') + def tags_by_category(self): + return split_tags(self.tags) + @permalink def get_absolute_url(self): return 'picture.views.picture_detail', [self.slug] diff --git a/src/picture/templates/picture/picture_short.html b/src/picture/templates/picture/picture_short.html index 05a0398ad..a065d4b5a 100644 --- a/src/picture/templates/picture/picture_short.html +++ b/src/picture/templates/picture/picture_short.html @@ -6,63 +6,67 @@
-
-
- {% for tag in tags.author %} - {{ tag }}{% if not forloop.last %}, - {% endif %}{% endfor %} -
- -
+ {% with picture.get_absolute_url as main_link %} + {% with picture.tags_by_category as tags %} +
+
+ {% for tag in tags.author %} + {{ tag }}{% if not forloop.last %}, + {% endif %}{% endfor %} +
+ +
-
- {% block picture-view %} - {% if main_link %}{% endif %} - {% thumbnail picture.image_file "216x288" crop="center" as thumb %} - - {% endthumbnail %} - {% if main_link %}{% endif %} - {% endblock %} - {# what about licensing icons here #} -
+
+ {% block picture-view %} + {% if main_link %}{% endif %} + {% thumbnail picture.image_file "216x288" crop="center" as thumb %} + + {% endthumbnail %} + {% if main_link %}{% endif %} + {% endblock %} + {# what about licensing icons here #} +
-
- {% spaceless %} - - {% trans "Epoch" %}:  - {% for tag in tags.epoch %} - {{ tag }} - {% if not forloop.last %}, {% endif %} - {% endfor %} +
+ {% spaceless %} + + {% trans "Epoch" %}:  + {% for tag in tags.epoch %} + {{ tag }} + {% if not forloop.last %}, {% endif %} + {% endfor %} + - - - {% trans "Kind" %}:  - {% for tag in tags.kind %} - {{ tag }} - {% if not forloop.last %}, {% endif %} - {% endfor %} + + {% trans "Kind" %}:  + {% for tag in tags.kind %} + {{ tag }} + {% if not forloop.last %}, {% endif %} + {% endfor %} + - - - {% trans "Genre" %}:  - {% for tag in tags.genre %} - {{ tag }} - {% if not forloop.last %}, {% endif %} - {% endfor %} + + {% trans "Genre" %}:  + {% for tag in tags.genre %} + {{ tag }} + {% if not forloop.last %}, {% endif %} + {% endfor %} + - - {% block extra_categories %} - {% endblock %} - {% endspaceless %} -
+ {% block extra_categories %} + {% endblock %} + {% endspaceless %} +
+ {% endwith %} + {% endwith %}
  • diff --git a/src/picture/templates/picture/picture_viewer.html b/src/picture/templates/picture/picture_viewer.html index bfa87b75a..d23148f0c 100644 --- a/src/picture/templates/picture/picture_viewer.html +++ b/src/picture/templates/picture/picture_viewer.html @@ -99,6 +99,6 @@
- {% ssi_include 'picture_short' pk=picture.pk %} + {% include 'picture/picture_short.html' %}
{% endblock %} diff --git a/src/picture/views.py b/src/picture/views.py index 381866a75..6ace13427 100644 --- a/src/picture/views.py +++ b/src/picture/views.py @@ -141,10 +141,7 @@ def picture_short(request, pk): return render(request, 'picture/picture_short.html', { 'picture': picture, - 'main_link': picture.get_absolute_url(), - 'request': request, - 'tags': split_tags(picture.tags), - }) + }) @ssi_included