How to use the ramp-frontend.ramp_frontend.forms.CreditForm.name_credits function in ramp-frontend

To help you get started, we’ve selected a few ramp-frontend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paris-saclay-cds / ramp-board / ramp-frontend / ramp_frontend / views / ramp.py View on Github external
)
    if submission is None or not access_code:
        error_str = 'Missing submission: {}'.format(submission_hash)
        return redirect_to_user(error_str)
    event_team = submission.event_team
    event = event_team.event
    source_submissions = get_source_submissions(db.session, submission.id)

    def get_s_field(source_submission):
        return '{}/{}/{}'.format(
            source_submission.event_team.event.name,
            source_submission.event_team.team.name,
            source_submission.name)

    # Make sure that CreditForm is empty
    CreditForm.name_credits = []
    credit_form_kwargs = {}
    for source_submission in source_submissions:
        s_field = get_s_field(source_submission)
        setattr(CreditForm, s_field, StringField('Text'))
    credit_form = CreditForm(**credit_form_kwargs)
    sum_credit = 0
    # new = True
    for source_submission in source_submissions:
        s_field = get_s_field(source_submission)
        submission_similaritys = \
            (SubmissionSimilarity.query
                                 .filter_by(
                                     type='target_credit',
                                     user=flask_login.current_user,
                                     source_submission=source_submission,
                                     target_submission=submission)