Mercurial > public > sg101
diff user_photos/views.py @ 1158:364f8ec48612
Updated User Photos to V3 design.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 23 Jan 2017 20:17:50 -0600 |
parents | d9cd3180c12c |
children |
line wrap: on
line diff
--- a/user_photos/views.py Thu Jan 19 18:35:53 2017 -0600 +++ b/user_photos/views.py Mon Jan 23 20:17:50 2017 -0600 @@ -7,6 +7,7 @@ from django.http import (HttpResponse, HttpResponseForbidden, HttpResponseNotAllowed, JsonResponse) from django.shortcuts import render, redirect, get_object_or_404 +from django.views.generic import DetailView from django.views.generic import ListView from django.views.decorators.http import require_POST from django.utils.decorators import method_decorator @@ -40,6 +41,7 @@ return render(request, 'user_photos/upload_form.html', { 'enabled': uploads_enabled, 'form': form, + 'V3_DESIGN': True, }, status=200 if uploads_enabled else 503) @@ -144,6 +146,8 @@ def get_context_data(self, **kwargs): context = super(GalleryView, self).get_context_data(**kwargs) context['gallery_owner'] = self.gallery_owner + context['V3_DESIGN'] = True + context['page'] = context['page_obj'] return context @method_decorator(login_required) @@ -151,6 +155,17 @@ return super(GalleryView, self).dispatch(*args, **kwargs) +class PhotoView(DetailView): + """A DetailView for displaying a user's photo""" + + model = Photo + + def get_context_data(self, **kwargs): + context = super(PhotoView, self).get_context_data(**kwargs) + context['V3_DESIGN'] = True + return context + + @login_required @require_POST def delete(request): @@ -228,4 +243,3 @@ status_code = 403 return JsonResponse(ret, status=status_code) -