Try another methode for photo metrics
This commit is contained in:
parent
239742bba0
commit
880e0e775d
1 changed files with 2 additions and 6 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue