예제 #1
0
def somedetails():
  form = CompleteProfileForm()

  if 'completeprofile' not in session:
    return redirect(url_for('dashboard'))

  if request.method == 'POST':
    if form.validate() == False:
      return render_template('somedetails.html', form=form)
    else:
      userinfo = User.query.filter_by(username=session['username']).first()
      if form.twitter.data >= 1:
        userinfo.twitter = form.twitter.data
        db.session.commit()
      if form.instagram.data >= 1:
        userinfo.instagram = form.instagram.data
        db.session.commit()
      if form.github.data >= 1:
        userinfo.github = form.github.data
        db.session.commit()
      if form.location.data >= 1:
        userinfo.location = form.location.data
        db.session.commit()
      if form.bio.data >= 1:
        userinfo.bio = form.bio.data
        db.session.commit()

      session.pop('completeprofile', None)

      return redirect(url_for('dashboard'))

  elif request.method == 'GET':
    return render_template('somedetails.html', form=form)
예제 #2
0
def accountsettings():
  form = CompleteProfileForm()

  user = User.query.filter_by(username = session['username']).first()

  if request.method == 'POST':
    if form.validate() == False:
      return render_template('accountsettings.html', form=form)
    else:
      if form.twitter.data >= 1:
        user.twitter = form.twitter.data
        db.session.commit()
      if form.instagram.data >= 1:
        user.instagram = form.instagram.data
        db.session.commit()
      if form.github.data >= 1:
        user.github = form.github.data
        db.session.commit()
      if form.location.data >= 1:
        user.location = form.location.data
        db.session.commit()
      if form.bio.data >= 1:
        user.bio = form.bio.data
        db.session.commit()

      return redirect(url_for('accountdetails'))

  elif request.method == 'GET':
    if user is None:
      print 'yes'
      return redirect(url_for('signin'))
    else:
      firstname = user.firstname
      lastname = user.lastname
      username = user.username
      figure = user.figure
      location = user.location
      following = user.following
      followers = user.followers
      twitter = user.twitter
      appreciations = user.appreciations
      instagram = user.instagram
      github = user.github
      bio = user.bio
      location = user.location



      return render_template('accountsettings.html', form=form, bio=bio, location=location,
                              github=github, instagram=instagram, username=username, firstname=firstname,
                              lastname=lastname, figure=figure, following=following,
                              followers=followers, twitter=twitter,
                              appreciations=appreciations)
예제 #3
0
def accountdetails():
  form = CompleteProfileForm()

  if 'username' not in session:
    return redirect(url_for('signin'))

  user = User.query.filter_by(username = session['username']).first()

  if user is None:
    return redirect(url_for('signin'))
  else:
    firstname = user.firstname
    lastname = user.lastname
    username = user.username
    figure = user.figure
    location = user.location
    following = user.following
    followers = user.followers
    twitter = user.twitter
    appreciations = user.appreciations
    instagram = user.instagram
    github = user.github
    bio = user.bio
    location = user.location


    return render_template('accountdetails.html', form=form, bio=bio, location=location,
                            github=github, instagram=instagram, username=username, firstname=firstname,
                            lastname=lastname, figure=figure, following=following,
                            followers=followers, twitter=twitter,
                            appreciations=appreciations)