From 880e0e775d3f093ed1451f653235e23e53e0c1e6 Mon Sep 17 00:00:00 2001 From: loulous27 Date: Thu, 4 Dec 2025 01:24:46 +0100 Subject: [PATCH] Try another methode for photo metrics --- photologue/views.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/photologue/views.py b/photologue/views.py index bf81c3c..094ef7c 100644 --- a/photologue/views.py +++ b/photologue/views.py @@ -22,8 +22,7 @@ from django.views.generic.edit import DeleteView, FormView from PIL import Image from django.contrib.auth import get_user_model -from django.db import models - +from django.db.models import F from .forms import UploadForm from .models import Gallery, Photo, Tag @@ -166,10 +165,7 @@ class GalleryDetailView(LoginRequiredMixin, DetailView): #Increment the photo view count - for photo in context["photos"]: - photo.increment_count() - - self.object.bulk_update(context["photos"],["increment_count"]) + context["photos"].update(increment_count=F('increment_count') + 1) return context