1
0
Fork 0

move reviews to new edition

This commit is contained in:
Matt Lehrer 2023-11-16 10:38:45 +01:00
parent 7684101f15
commit bd920a4630
2 changed files with 37 additions and 0 deletions

View file

@ -110,4 +110,11 @@ def switch_edition(request):
rating.book = new_edition
rating.save()
reviews = models.Review.objects.filter(
book__parent_work=new_edition.parent_work, user=request.user
)
for review in reviews.all():
review.book = new_edition
review.save()
return redirect(f"/book/{new_edition.id}")