Skip to content
Snippets Groups Projects
Unverified Commit fd9ad57b authored by Tomasz Knapik's avatar Tomasz Knapik
Browse files

use dict instead of ordereddict

parent cbd964af
No related branches found
No related tags found
No related merge requests found
...@@ -20,22 +20,22 @@ class ActionSerializer(serializers.Field): ...@@ -20,22 +20,22 @@ class ActionSerializer(serializers.Field):
class ReviewSummarySerializer(serializers.Field): class ReviewSummarySerializer(serializers.Field):
def to_representation(self, instance): def to_representation(self, instance):
reviews = instance.reviews.all() reviews = instance.reviews.select_related('author')
return { return {
'count': len(reviews), 'count': len(reviews),
'score': reviews.score(), 'score': reviews.score(),
'recommendation': reviews.recommendation(), 'recommendation': reviews.recommendation(),
'reviews': [ 'reviews': [
OrderedDict([ {
('id', review.id), 'id': review.id,
('author', str(review.author)), 'author': str(review.author),
('score', review.score), 'score': review.score,
('recommendation', OrderedDict([ 'recommendation': {
('value', review.recommendation), 'value': review.recommendation,
('display', review.get_recommendation_display()), 'display': review.get_recommendation_display(),
])), },
('review_url', review.get_absolute_url()), 'review_url': review.get_absolute_url(),
]) for review in reviews } for review in reviews
] ]
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment