mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-13 18:59:24 +00:00
remove unnecessary loop.
ReviewRatings are a subclass and are included in the models.Review block
This commit is contained in:
parent
bf81192d73
commit
f4da9fbf34
|
@ -103,17 +103,12 @@ def switch_edition(request):
|
||||||
readthrough.book = new_edition
|
readthrough.book = new_edition
|
||||||
readthrough.save()
|
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()
|
|
||||||
|
|
||||||
reviews = models.Review.objects.filter(
|
reviews = models.Review.objects.filter(
|
||||||
book__parent_work=new_edition.parent_work, user=request.user
|
book__parent_work=new_edition.parent_work, user=request.user
|
||||||
)
|
)
|
||||||
for review in reviews.all():
|
for review in reviews.all():
|
||||||
|
# because ratings are a subclass of reviews,
|
||||||
|
# this will pick up both ratings and reviews
|
||||||
review.book = new_edition
|
review.book = new_edition
|
||||||
review.save()
|
review.save()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue