示例#1
0
def profile_settings_personal(user):

	user_information_update = user_information.profile_info_update(current_user.info_id)

	photo = user_photo.photo(current_user.info_id)

	form = ProfilePersonalUpdateForm()

	if form.validate_on_submit():

		user_information_update.first_name = form.firstname.data
		user_information_update.middle_name = form.middlename.data
		user_information_update.last_name = form.lastname.data
		user_information_update.gender = form.gender.data
		user_information_update.birthday = form.birthday.data
		user_information_update.bio = form.bio.data

		db.session.commit()

		flash('Profile was successfully updated!', 'success')

		return redirect(url_for('registered.profile_settings_personal', user=current_user.username))

	else:

		form.firstname.data = user_information_update.first_name
		form.middlename.data = user_information_update.middle_name
		form.lastname.data = user_information_update.last_name
		form.gender.data = user_information_update.gender
		form.birthday.data = user_information_update.birthday
		form.bio.data = user_information_update.bio

	return render_template('/registered/profile/settings/personal.html', form=form, photo=photo)
示例#2
0
def contactus():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/linkages/contactus/index.html',
                           photo=photo,
                           active='contactus')
示例#3
0
def index():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/religious_admin/index.html',
                           active='home',
                           photo=photo)
示例#4
0
def termsandconditions():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/linkages/termsandconditions/index.html',
                           photo=photo,
                           active='termsandconditions')
示例#5
0
def events(status, page, search):

    if status == 'scheduled':
        value = 'S'
    elif status == 'new':
        value = 'N'
    elif status == 'finished':
        value = 'F'
    else:
        value = status

    events = event_views.religious_admin_events([value, search, page])

    photo = user_photo.photo(current_user.info_id)

    form = SearchForm()

    if form.validate_on_submit():

        return redirect(
            url_for('religious_admin.events',
                    status=status,
                    page='1',
                    search=form.search.data))

    return render_template('/religious_admin/events/index.html',
                           title="Events",
                           form=form,
                           events=events,
                           status=status,
                           search=search,
                           active='events',
                           photo=photo)
示例#6
0
def profile_eventsattended(user):

    photo = user_photo.photo(current_user.info_id)

    return render_template('/communities/profile/eventsattended.html',
                           title="Profile",
                           photo=photo)
示例#7
0
def termsandconditions():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/communities/termsandconditions/index.html',
                           title="Terms and Conditions",
                           photo=photo)
示例#8
0
def contactus():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/communities/contactus/index.html',
                           title="Contact Us",
                           photo=photo)
示例#9
0
def events_calendar():

	photo = user_photo.photo(current_user.info_id)

	events = event_information.calendar()
	
	return render_template('/registered/events/index-calendar.html', title="Events", events=events, photo=photo, active='events')
示例#10
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)
示例#11
0
def index():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/communities/index.html',
                           title="Home",
                           photo=photo,
                           active='home')
示例#12
0
def donate():

	photo = user_photo.photo(current_user.info_id)

	form = DonationForm()

	donations = donation_views.donation_history(current_user.info_id)

	communities = linkage_views.target_linkages()

	for c in communities:

		if c.type==4:
			form.sponsee.choices.extend([(str(c.id), c.address)])

	events = event_information.select_list()

	if events:

		for e in events:
			form.event.choices.append((str(e.id), e.name))
			no_event = 0

	else: 
		
		form.event.data=''
		no_event = 1

	if form.validate_on_submit():

		if form.give_to.data=='1':
			if form.sponsee.data:
				sponsee = form.sponsee.data
			else:
				sponsee = 1

			event = None
		else:
			event = form.event.data
			sponsee= None

		file = form.trans_slip.data
		old, extension = os.path.splitext(file.filename)

		new = donation.last_added()
		filename = str(new)+extension

		trans_path = 'static/output/donate/trans_slip/' + filename

		value = [None,sponsee,event,current_user.info_id,form.amount.data,trans_path,'N']

		donation.add(value)
		file.save(trans_path)

		flash('Donation given!', 'success')
		return redirect(url_for('registered.donate'))

	return render_template('/registered/donate/index.html', form=form, no_event=no_event, donations=donations, photo=photo, active='donate')
示例#13
0
def events_calendar():

    events = event_information.calendar()

    photo = user_photo.photo(current_user.info_id)

    return render_template('/religious_admin/events/index-calendar.html',
                           title="Events",
                           events=events,
                           active='events',
                           photo=photo)
示例#14
0
def communities(page, search):

	communities = linkage_views.show_list(['all',search,4, page])

	photo = user_photo.photo(current_user.info_id)

	form = SearchForm()

	if form.validate_on_submit():

		return redirect(url_for('registered.communities', page='1', search=form.search.data))

	return render_template('/registered/communities/index.html', form=form, communities=communities, search=search, photo=photo, active='communities')
示例#15
0
def linkages(page, search):

	linkages = linkage_views.show_list(['A', search, 3, page])

	photo = user_photo.photo(current_user.info_id)

	form = SearchForm()

	if form.validate_on_submit():

		return redirect(url_for('registered.linkages', page='1', search=form.search.data))

	return render_template('/registered/linkages/index.html', title="linkages", form=form, linkages=linkages, page=page, search=search, photo=photo, active='linkages')
示例#16
0
def members(search):

    members = community_views.members_list(search)

    photo = user_photo.photo(current_user.info_id)

    form = SearchForm()

    if form.validate_on_submit():

        return redirect(url_for('communities.members',
                                search=form.search.data))

    return render_template('/communities/members/index.html',
                           title="Members",
                           members=members,
                           form=form,
                           search=search,
                           photo=photo,
                           active='members')
示例#17
0
def linkages_show(page, search):

    linkages = linkage_views.show_list(['A', search, 3, page])

    photo = user_photo.photo(current_user.info_id)

    form = SearchForm()

    if form.validate_on_submit():

        return redirect(
            url_for('linkages.linkages_show',
                    page='1',
                    search=form.search.data))

    return render_template('/linkages/linkages/index.html',
                           linkages=linkages,
                           form=form,
                           search=search,
                           user=current_user.info_id,
                           photo=photo,
                           active='linkages')
示例#18
0
def referral_users():

	photo = user_photo.photo(current_user.info_id)

	form = ReferralForm()

	if form.validate_on_submit():

		html = 'asdlkfjasfd'
		subject = 'REFFERAL: '
		admin = user_account.query.by(id=1).first()

		email_parts = [html, subject, admin.email_address, form.email.data, None]
		send_email(email_parts)

		value = [None, current_user.id, form.name.data, form.email.data, form.type.data, 'N']

		referral.add(value)

		flash('Referral has been sent!', 'success')
		return redirect(url_for('registered.referral_users'))

	return render_template('/registered/referral/index.html', form=form, photo=photo, active='referral')
示例#19
0
def events(status, page, search):

	if status=='scheduled':
		value='S'
	elif status=='new':
		value='N'
	elif status=='finished':
		value='F'
	else:
		value=status

	events = event_views.registered_events([value, search, page])

	photo = user_photo.photo(current_user.info_id)

	form = SearchForm()

	user = event_participation.user_joined(current_user.info_id)

	if form.validate_on_submit():

		return redirect(url_for('registered.events', status=status, page='1', search=form.search.data))

	return render_template('/registered/events/index.html', title="Events", form=form, events=events, user=user, status=status, search=search, photo=photo, active='events')
示例#20
0
def profile_eventsattended(user):

	photo = user_photo.photo(current_user.info_id)
	
	return render_template('/registered/profile/eventsattended.html', title="registered", photo=photo, active='eventsattended')	
示例#21
0
def events(status, search, page):

    if status == 'scheduled':
        value = 'S'
    elif status == 'new':
        value = 'N'
    elif status == 'pending':
        value = 'P'
    elif status == 'cancelled':
        value = 'C'
    elif status == 'declined':
        value = 'X'
    elif status == 'finished':
        value = 'F'
    else:
        value = status

    events = event_views.linkages_events([value, search, page])
    letters = event_attachment.letter_attached()

    photo = user_photo.photo(current_user.info_id)

    form = AttachLetterForm()

    if form.validate_on_submit():

        attach_letter = form.attach_letter.data
        old, extension = os.path.splitext(attach_letter.filename)
        filename = str(form.event_id.data) + extension
        file_path = 'static/attachment/signed_letter/' + filename

        value = [None, form.event_id.data, file_path, 3]

        event_attachment.add(value)
        attach_letter.save(file_path)

        flash('Letter successfully attached!', 'success')

        return redirect(
            url_for('linkages.events', status=status, page='1', search=' '))

    form_search = SearchForm()

    if form_search.validate_on_submit():

        return redirect(
            url_for('linkages.events',
                    status=status,
                    page='1',
                    search=form_search.search.data))

    return render_template('/linkages/events/index.html',
                           title="Events",
                           form_search=form_search,
                           form=form,
                           events=events,
                           status=status,
                           letters=letters,
                           now=datetime.now(),
                           search=search,
                           photo=photo,
                           active='events')
示例#22
0
def index():

    photo = user_photo.photo(current_user.info_id)

    return render_template('/linkages/index.html', photo=photo, active='home')