forked from gergely/calendar-social
Make it possible to edit one’s profile
…even though it’s only one field yet.
This commit is contained in:
@@ -399,5 +399,21 @@ class CalendarSocialApp(Flask):
|
||||
|
||||
return render_template('first-steps.html', form=form)
|
||||
|
||||
@staticmethod
|
||||
@route('/edit-profile', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def edit_profile():
|
||||
from .forms import ProfileForm
|
||||
from .models import db
|
||||
|
||||
form = ProfileForm(current_user.profile)
|
||||
|
||||
if form.validate_on_submit():
|
||||
form.populate_obj(current_user.profile)
|
||||
db.session.add(current_user.profile)
|
||||
db.session.commit()
|
||||
|
||||
return render_template('profile-edit.html', form=form)
|
||||
|
||||
|
||||
app = CalendarSocialApp(__name__)
|
||||
|
Reference in New Issue
Block a user