diff --git a/core/templates/core/user_pictures.jinja b/core/templates/core/user_pictures.jinja new file mode 100644 index 00000000..e4cf9055 --- /dev/null +++ b/core/templates/core/user_pictures.jinja @@ -0,0 +1,21 @@ +{% extends "core/base.jinja" %} +{% from "core/macros.jinja" import user_link_with_pict, delete_godfather %} + +{% block title %} +{% trans user_name=profile.get_display_name() %}{{ user_name }}'s pictures{% endtrans %} +{% endblock %} + +{% block content %} +{% for r in user.pictures.exclude(picture=None).values('user__pictures__picture__parent').distinct() %} +{% set album = user.pictures.filter(picture__parent=r['user__pictures__picture__parent']).first().picture.parent %} +

{{ album.name }}

+{% for r in user.pictures.exclude(picture=None).filter(picture__parent=album) %} +
+ + {{ r.picture.get_display_name() }} + +
+{% endfor %} +{% endfor %} +{% endblock %} + diff --git a/core/urls.py b/core/urls.py index 1224c766..e1467971 100644 --- a/core/urls.py +++ b/core/urls.py @@ -32,6 +32,7 @@ urlpatterns = [ url(r'^user/$', UserListView.as_view(), name='user_list'), url(r'^user/(?P[0-9]+)/mini$', UserMiniView.as_view(), name='user_profile_mini'), url(r'^user/(?P[0-9]+)/$', UserView.as_view(), name='user_profile'), + url(r'^user/(?P[0-9]+)/pictures$', UserPicturesView.as_view(), name='user_pictures'), url(r'^user/(?P[0-9]+)/godfathers$', UserGodfathersView.as_view(), name='user_godfathers'), url(r'^user/(?P[0-9]+)/godfathers/(?P[0-9]+)/(?P(True)|(False))/delete$', DeleteUserGodfathers, name='user_godfathers_delete'), url(r'^user/(?P[0-9]+)/edit$', UserUpdateProfileView.as_view(), name='user_edit'), diff --git a/core/views/user.py b/core/views/user.py index 46f68971..06cb27ca 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -134,6 +134,11 @@ class UserTabsMixin(TabedViewMixin): 'slug': 'godfathers', 'name': _("Godfathers"), }) + tab_list.append({ + 'url': reverse('core:user_pictures', kwargs={'user_id': self.object.id}), + 'slug': 'pictures', + 'name': _("Pictures"), + }) if self.request.user == self.object: tab_list.append({ 'url': reverse('core:user_tools'), @@ -201,6 +206,15 @@ def DeleteUserGodfathers(request, user_id, godfather_id, is_father): raise PermissionDenied return redirect('core:user_godfathers', user_id=user_id) +class UserPicturesView(UserTabsMixin, CanViewMixin, DetailView): + """ + Display a user's pictures + """ + model = User + pk_url_kwarg = "user_id" + context_object_name = "profile" + template_name = "core/user_pictures.jinja" + current_tab = 'pictures' class UserGodfathersView(UserTabsMixin, CanViewMixin, DetailView): """ diff --git a/sas/templates/sas/album.jinja b/sas/templates/sas/album.jinja index 5555ff55..e9269798 100644 --- a/sas/templates/sas/album.jinja +++ b/sas/templates/sas/album.jinja @@ -4,7 +4,16 @@ {% trans %}SAS{% endtrans %} {% endblock %} +{% macro print_path(file) %} +{% if file %} +{{ print_path(file.parent) }} +{{ file.get_display_name() }} > +{% endif %} +{% endmacro %} + + {% block content %} +{{ print_path(album.parent) }} {{ album.get_display_name() }}

{{ album.get_display_name() }}

{% for a in album.children.filter(is_folder=True, is_moderated=True).all() %}