def register(): """Register new user.""" form = RegisterForm(request.form) if form.validate_on_submit(): User.create(firstname=form.firstname.data, lastname=form.lastname.data, email=form.email.data, club=form.club.data, password=form.password.data, active=True) flash( 'Danke für deine Registration. Du kannst dich jetzt einloggen und Teilnehmer erfassen', 'success') return redirect(url_for('public.home')) else: flash_errors(form) return render_template('public/register.html', form=form)
def home(): """Home page.""" if current_user.is_authenticated: return redirect(url_for('events.events_overview')) form = LoginForm(request.form) # Handle logging in if request.method == 'POST': if form.validate_on_submit(): login_user(form.user) flash('Du bist jetzt eingeloggt.', 'success') redirect_url = request.args.get('next') or url_for( 'events.events_overview') return redirect(redirect_url) else: flash_errors(form) return render_template('public/home.html', form=form)
def judo_turnier_application(): """Show application form to apply for event.""" form = ParticipantFormJudoTurnier(request.form) if form.validate_on_submit(): Participant.create(event=EVENT_JUDO_TURNIER, lastname=form.lastname.data, firstname=form.firstname.data, birthday=form.birthday.data, level=form.level.data, sex=form.sex.data, weight=form.weight.data, remark=form.remark.data, user=current_user) flash( 'Neuer Teilnehmer "{} {}" wurde erfolgreich erfasst.'.format( form.firstname.data, form.lastname.data), 'success') return redirect(url_for('events.judo_turnier')) else: flash_errors(form) return render_template('events/judo-turnier-application.html', form=form)
def aikido_stage_application(): """Show application form to apply for event.""" form = ParticipantFormAikidoStage(request.form) if form.validate_on_submit(): Participant.create(event=EVENT_AIKIDO_STAGE, lastname=form.lastname.data, firstname=form.firstname.data, birthday=form.birthday.data, level=form.level.data, sex=form.sex.data, weight=None, remark=form.remark.data, user=current_user) flash( 'Neuer Teilnehmer "{} {}" wurde erfolgreich erfasst.'.format( form.firstname.data, form.lastname.data), 'success') return redirect(url_for('events.aikido_stage')) else: flash_errors(form) return render_template('events/aikido-stage-application.html', form=form)