def update(postid, userid, rating):
        '''
        Update the rating of certain post and user.
        The record will be created if no record exists.
        '''
        rating_recs = TabRating.select().where(
            (TabRating.post_id == postid) & (TabRating.user_id == userid)
        )
        if rating_recs.count() > 0:
            MRating.__update_rating(rating_recs.get().uid, rating)
        else:
            MRating.__insert_data(postid, userid, rating)
Update the rating of certain post and user.
        The record will be created if no record exists.