From: Radek Czajka Date: Wed, 22 Oct 2014 08:55:56 +0000 (+0200) Subject: Fixes #3396: More pictures info. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/e7c8c7e1fd0fe2eb867b26ae205b75822204a45f Fixes #3396: More pictures info. --- diff --git a/apps/picture/migrations/0005_auto_20141022_1001.py b/apps/picture/migrations/0005_auto_20141022_1001.py new file mode 100644 index 000000000..e5e87387c --- /dev/null +++ b/apps/picture/migrations/0005_auto_20141022_1001.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + +def rebuild_extra_info(apps, schema_editor): + Picture = apps.get_model("picture", "Picture") + from librarian.picture import PictureInfo + from librarian import dcparser + for pic in Picture.objects.all(): + info = dcparser.parse(pic.xml_file.path, PictureInfo) + pic.extra_info = info.to_dict() + pic.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('picture', '0004_auto_20141016_1337'), + ] + + operations = [ + migrations.RunPython(rebuild_extra_info), + ] diff --git a/apps/picture/templates/picture/picture_short.html b/apps/picture/templates/picture/picture_short.html index 881dcfe21..1bd70a11b 100644 --- a/apps/picture/templates/picture/picture_short.html +++ b/apps/picture/templates/picture/picture_short.html @@ -60,6 +60,9 @@ {% endfor %} + {% block extra_categories %} + {% endblock %} + {% endspaceless %} diff --git a/apps/picture/templates/picture/picture_wide.html b/apps/picture/templates/picture/picture_wide.html index e2fab8cab..9f47c7baa 100644 --- a/apps/picture/templates/picture/picture_wide.html +++ b/apps/picture/templates/picture/picture_wide.html @@ -13,6 +13,39 @@ {% endblock %} +{% block extra_categories %} +{% if picture.extra_info.styles %} + + {% trans "Style" %}:  + {% for tag in picture.extra_info.styles %} + {{ tag }} + {% if not forloop.last %}, {% endif %} + {% endfor %} + +{% endif %} + +{% if picture.extra_info.medium %} + + {% trans "Medium" %}:  + {{ picture.extra_info.medium }} + +{% endif %} + +{% if picture.extra_info.original_dimensions %} + + {% trans "Dimensions" %}:  + {{ picture.extra_info.original_dimensions }} + +{% endif %} + + + {% trans "Date" %}:  + {{ picture.extra_info.created_at }} + + +{% endblock %} + + {% block book-box-extra-info %} {% if themes or things%}
diff --git a/lib/librarian b/lib/librarian index a3b684052..a04f11bae 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit a3b6840527ec52ce8b6d74819633d8c85e3973ba +Subproject commit a04f11baee3eb7d090867c2d5639a120ec3217b8