From 8771cc9b8636179f94ceba3ece16ec500ce1b8bf Mon Sep 17 00:00:00 2001 From: Skia Date: Wed, 30 Nov 2016 12:58:52 +0100 Subject: [PATCH] Enhance user picture view --- core/templates/core/base.jinja | 2 +- core/templates/core/user_pictures.jinja | 34 +++++++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/core/templates/core/base.jinja b/core/templates/core/base.jinja index a6d56e54..e602fe5e 100644 --- a/core/templates/core/base.jinja +++ b/core/templates/core/base.jinja @@ -85,7 +85,7 @@
{% for t in list_of_tabs %} {{ t.name }} diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja index 5ee4a51e..3a79454e 100644 --- a/core/templates/core/user_pictures.jinja +++ b/core/templates/core/user_pictures.jinja @@ -6,19 +6,27 @@ {% endblock %} {% block content %} -{% for r in profile.pictures.exclude(picture=None).values('user__pictures__picture__parent').distinct() %} -
- {% set album = profile.pictures.filter(picture__parent=r['user__pictures__picture__parent']).first().picture.parent %} -

{{ album.name }}

-
- {% for r in profile.pictures.exclude(picture=None).filter(picture__parent=album).order_by('id') %} -
- - {{ r.picture.get_display_name() }} - +{% set album = None %} +{% set new_album = True %} +{% for r in profile.pictures.exclude(picture=None).order_by('-picture__parent__id', 'id') -%} + {%- if album != r.picture.parent %} + {%- if album %} +
+ {% endif -%} + {% set new_album = True %} + {% set album = r.picture.parent %} +
+

{{ album.name }}

+
+ {% else %} + {% set new_album = False %} + {%- endif %} +
+ + {{ r.picture.get_display_name() }} + +
+{%- endfor %}
- {% endfor %} -
-{% endfor %} {% endblock %}