mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-04-14 06:14:05 +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
1 changed files with 2 additions and 7 deletions
|
@ -103,17 +103,12 @@ 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()
|
||||
|
||||
reviews = models.Review.objects.filter(
|
||||
book__parent_work=new_edition.parent_work, user=request.user
|
||||
)
|
||||
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.save()
|
||||
|
||||
|
|
Loading…
Reference in a new issue