def build_review_form(paper_revision=None, review_type=None, review=None): if review: paper_revision = review.revision review_type = PaperTypeProxy(review.type) review_form_class = make_review_form(paper_revision.paper.event, review_type=review_type.instance) reviews = paper_revision.get_reviews(user=session.user, group=review_type.instance) latest_user_review = reviews[0] if reviews else None if latest_user_review: answers = {'question_{}'.format(rating.question.id): rating.value for rating in latest_user_review.ratings} defaults = FormDefaults(obj=latest_user_review, **answers) else: defaults = FormDefaults() return review_form_class(prefix='type-{}'.format(review_type.instance.value), obj=defaults, paper=paper_revision.paper, edit=review is not None)
def _process_args(self): RHPaperBase._process_args(self) self.type = PaperTypeProxy( PaperReviewType[request.view_args['review_type']])
def _checkParams(self, params): RHPaperBase._checkParams(self, params) self.type = PaperTypeProxy( PaperReviewType[request.view_args['review_type']])