def show_yeargroup_by_year_and_id(year, id): revue_year = groups.get_revue_year_by_year(year) year_group = groups.get_group_by_id(id) page = group_pages.get_or_create_year_group_year_page(year_group, revue_year) members = year_group.members(revue_year) return render_template("internal/groups/year_group_year.html", group=year_group, members=members, year=revue_year, page=page, current_user_member=get_current_user() in members, is_year_participant=groups.get_year_participation(revue_year, get_current_user()) is not None, has_requested_year_participation=groups.get_year_participation_request(revue_year, get_current_user()) is not None)
def show_yeargroup(year_group): members = groups.get_year_group_members_by_year(year_group) menu_structure = menus.get_menu_structure(groups.get_group_menu(year_group)) years = sorted(members.keys()) data_per_year = [{ "year": groups.get_revue_year_by_year(y), "members": members[y], "current_user_member": get_current_user() in members[y], "user_requested_year_participation": groups.get_year_participation_request( groups.get_revue_year_by_year(y), get_current_user()) is not None, "user_member_of_year": groups.get_year_participation(groups.get_revue_year_by_year(y), get_current_user()) is not None } for y in years] return render_template("internal/groups/year_group.html", group=year_group, data_per_year=data_per_year, menu=menu_structure)
def profile(): user = session.get_current_user() info_form = UpdateUserInfoForm(request.form, user) if info_form.validate_on_submit(): info_form.populate_obj(user) db.session.commit() return render_template("internal/user/user_edit.html", info_form=info_form)
def show_persistent_group(persistent_group): members = groups.get_persistent_group_members(persistent_group) menu_structure = menus.get_menu_structure(groups.get_group_menu(persistent_group)) return render_template("internal/groups/persistent_group.html", group=persistent_group, members=members, menu=menu_structure, current_user_member=groups.get_persistent_group_participation( persistent_group=persistent_group, user=get_current_user()) is not None)
def new_password(): password_form = UpdateUserPasswordForm(request.form) if request.method == "POST" and password_form.validate(): h = bcrypt.generate_password_hash(password_form.password.data) user = session.get_current_user() user.password = h.decode("utf-8") db.session.commit() flash('Password successfully updated', 'success') return redirect(url_for('.profile')) return render_template('internal/user/new_password.html', password_form=password_form)
def show_year(year): revue_year = groups.get_revue_year_by_year(year) year_groups = groups.get_year_groups() return render_template("internal/groups/year.html", year=revue_year, members=groups.get_revue_year_members(revue_year), year_groups=year_groups, user_is_member_of_year=groups.get_year_participation(revue_year, get_current_user()) is not None, user_has_requested_year_participation=groups.get_year_participation_request(revue_year, get_current_user()) is not None)
def view_own_groups(): user = session.get_current_user() return view_user_groups(user)
def view_user(username): if username is None: user = session.get_current_user() else: user = User.query.filter_by(username=username).first() return user_view.show_user(user)
def join_year(year): revue_year = groups.get_revue_year_by_year(year) groups.request_year_participation(revue_year, get_current_user()) flash('Successfully asked to join year', 'success') return redirect(url_for('.index'))
def leave_persistent_group_by_id(id): persistent_group = groups.get_group_by_id(id) groups.leave_persistent_group(persistent_group, get_current_user()) flash('Successfully left group!', 'success') return redirect(url_for('.show_group_by_id', id=id))
def leave_yeargroup_by_year_and_id(year, id): revue_year = groups.get_revue_year_by_year(year) year_group = groups.get_group_by_id(id) groups.leave_year_group(year_group, revue_year, get_current_user()) flash('Successfully left group!', 'success') return redirect(url_for('.show_yeargroup_by_year_and_id', year=year, id=id))
def join_persistent_group_by_id(id): persistent_group = groups.get_group_by_id(id) groups.join_persistent_group(persistent_group=persistent_group, user=get_current_user()) flash('Successfully joined group!', 'success') return redirect(url_for('.show_group_by_id', id=id))