Skip to content

Commit

Permalink
Removed the elif conditional in edit_photo
Browse files Browse the repository at this point in the history
  • Loading branch information
albertiaedev committed Dec 8, 2023
1 parent 330f5da commit 1f89c5d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions photoapp/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@ def edit_photo(request):
photo.description = request.POST.get('description')
photo.save()
return HttpResponse('Your photo has been edited successfully...')
elif Photo.DoesNotExist:
return HttpResponse("Photo does not exist.", status=404)
return HttpResponse("Photo does not exist.", status=404)
elif request.method == 'GET':
photo_id = request.GET.get('photo_id')
if photo_id:
photo = Photo.objects.get(id=photo_id)
return render(request, 'app/edit.html', {'photo': photo})
elif Photo.DoesNotExist:
return HttpResponse("Photo does not exist.", status=404)
return HttpResponse("Photo does not exist.", status=404)

return redirect('gallery')

0 comments on commit 1f89c5d

Please sign in to comment.