1
0
Fork 0

move ratings to new edition

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

View file

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