Adds ReviewRating model
I can't just calling Rating because that would clash with the rating field
This commit is contained in:
@ -222,6 +222,22 @@ class Review(Status):
|
||||
pure_type = 'Article'
|
||||
|
||||
|
||||
class ReviewRating(Review):
|
||||
''' a subtype of review that only contains a rating '''
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.rating:
|
||||
raise ValueError('Rating object must include a numerical rating')
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def pure_content(self):
|
||||
#pylint: disable=bad-string-format-type
|
||||
return 'Rated "%s": %d' % (self.book.title, self.rating)
|
||||
|
||||
activity_serializer = activitypub.Rating
|
||||
pure_type = 'Note'
|
||||
|
||||
|
||||
class Boost(Status):
|
||||
''' boost'ing a post '''
|
||||
boosted_status = fields.ForeignKey(
|
||||
|
Reference in New Issue
Block a user