How to use the ramp-frontend.ramp_frontend.forms.AskForEventForm 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
def ask_for_event(problem_name):
    problem = Problem.query.filter_by(name=problem_name).one_or_none()
    if problem is None:
        return redirect_to_user(
            '{}: no problem named "{}"'
            .format(flask_login.current_user.firstname, problem_name)
        )
    logger.info('{} is asking for event on {}'
                .format(flask_login.current_user.name, problem.name))
    # We assume here that event name has the syntax _
    form = AskForEventForm(
        min_duration_between_submissions_hour=8,
        min_duration_between_submissions_minute=0,
        min_duration_between_submissions_second=0,
    )
    if form.validate_on_submit():
        admin_users = User.query.filter_by(access_level='admin')
        for admin in admin_users:
            subject = 'Request to add a new event'
            body = """User {} asked to add a new event:
            event name: {}
            event title: {}
            number of students: {}
            waiting time between resubmission: {}:{}:{}
            opening data: {}
            closing data: {}
            """.format(