From be9d6caf94268b8bb23b081781704f9c631c660a Mon Sep 17 00:00:00 2001 From: Stephan Kerkman Date: Sat, 30 May 2026 21:33:22 +0200 Subject: [PATCH] fix: re-fetch plant after photo upload so gallery and hero see new photo --- plants/views/plants.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plants/views/plants.py b/plants/views/plants.py index d07d3ac..b74702b 100644 --- a/plants/views/plants.py +++ b/plants/views/plants.py @@ -211,9 +211,10 @@ def crop_thumbnail(request, pk): def upload_photo(request, pk): - plant = get_object_or_404(Plant.objects.prefetch_related('photos'), pk=pk) + plant = get_object_or_404(Plant, pk=pk) if request.FILES.get('image'): PlantPhoto.objects.create(plant=plant, image=request.FILES['image']) + plant = Plant.objects.prefetch_related('photos').get(pk=pk) return render(request, 'plants/partials/photo_gallery.html', {'plant': plant})