Beispiel #1
0
def profile_about(user):

    linkages = user_views.profile_info(current_user.info_id)

    photo = user_photo.photo(current_user.info_id)
    form = PictureForm()

    if form.validate_on_submit():

        file = form.photo.data
        old, extension = os.path.splitext(file.filename)
        filename = str(current_user.info_id) + extension
        file_path = 'static/photos/profiles/' + filename

        file.save(file_path)

        if photo:
            user_photo.update([current_user.info_id, file_path])
        else:
            user_photo.add([None, current_user.info_id, file_path])

        flash('Profile picture has been updated!', 'success')
        return redirect(url_for('linkages.profile_about', user=user))

    return render_template('/linkages/profile/about.html',
                           title="Linkages",
                           photo=photo,
                           form=form,
                           linkages=linkages)
Beispiel #2
0
def member_add():

    form = AddMemberForm()

    if form.validate_on_submit():

        for_company = user_views.profile_info(current_user.info_id)

        value = [
            None, form.firstname.data, form.middlename.data,
            form.lastname.data, for_company.company_name, None,
            form.gender.data, form.birthday.data, form.address.data,
            form.telephone.data, form.mobile.data, 0
        ]

        user_information.add(value)

        user_id = user_information.reserve_id()

        if form.occupation.data == '':
            occupation = None
        else:
            occupation = form.occupation.data

        value = [
            None, user_id, current_user.info_id, occupation, form.income.data,
            form.religion.data, "A"
        ]

        community.add(value)

        flash('Member added!', 'success')
        return redirect(url_for('communities.members', search=' '))

    return render_template('/communities/members/add.html',
                           title="Add Member",
                           form=form,
                           active='members')