2018-09-16 16:52:23 +00:00
|
|
|
from rest_framework import serializers
|
2018-09-25 20:52:38 +00:00
|
|
|
from postings.models import *
|
2018-09-16 16:52:23 +00:00
|
|
|
|
|
|
|
|
2018-09-25 20:52:38 +00:00
|
|
|
|
|
|
|
# Serializes the generic Review object.
|
|
|
|
class ReviewSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = Review
|
|
|
|
fields = [
|
|
|
|
'pk',
|
|
|
|
'rating',
|
|
|
|
'title',
|
|
|
|
'content',
|
|
|
|
'rateable_entity',
|
|
|
|
'created_date',
|
|
|
|
'last_updated_date'
|
|
|
|
]
|
|
|
|
read_only_fields = [
|
|
|
|
'pk',
|
|
|
|
'created_date',
|
|
|
|
'rateable_entity'
|
|
|
|
]
|
|
|
|
|
2018-10-11 09:18:48 +00:00
|
|
|
class ReviewHelpfulVoteSerializer(serializers.ModelSerializer):
|
2018-09-25 20:52:38 +00:00
|
|
|
class Meta:
|
2018-10-11 09:18:48 +00:00
|
|
|
model = ReviewHelpfulVote
|
2018-09-25 20:52:38 +00:00
|
|
|
fields = [
|
|
|
|
'pk',
|
2018-10-11 09:18:48 +00:00
|
|
|
'review',
|
|
|
|
'helpful',
|
|
|
|
'user'
|
2018-09-25 20:52:38 +00:00
|
|
|
]
|
|
|
|
read_only_fields = [
|
|
|
|
'pk'
|
2018-10-11 09:18:48 +00:00
|
|
|
]
|