From 0bf340727e82ffdb03196a5a9a8ff94c7d4ec0f7 Mon Sep 17 00:00:00 2001 From: cfdv Date: Sat, 18 Jun 2011 21:30:56 -0500 Subject: [PATCH] enables entering user details including website url and bio fixes usage of objects. still need to display the data on user page --- mediagoblin/edit/routing.py | 3 +-- mediagoblin/edit/views.py | 7 ++++--- mediagoblin/templates/mediagoblin/edit/edit_profile.html | 2 +- mediagoblin/templates/mediagoblin/root.html | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mediagoblin/edit/routing.py b/mediagoblin/edit/routing.py index 37595f05..9604d214 100644 --- a/mediagoblin/edit/routing.py +++ b/mediagoblin/edit/routing.py @@ -20,5 +20,4 @@ from routes.route import Route edit_routes = [ # Media editing view handled in user_pages/routing.py Route('mediagoblin.edit.profile', '/{user}/profile/', - controller="mediagoblin.edit.views:edit_profile") -] + controller="mediagoblin.edit.views:edit_profile")] diff --git a/mediagoblin/edit/views.py b/mediagoblin/edit/views.py index cb62d2fa..57c9a118 100644 --- a/mediagoblin/edit/views.py +++ b/mediagoblin/edit/views.py @@ -63,16 +63,17 @@ def edit_media(request, media): @require_active_login def edit_profile(request): + user = request.user form = forms.EditProfileForm(request.POST, - url = user['url'], - bio = user['bio']) + url = user.get('url'), + bio = user.get('bio')) if request.method == 'POST' and form.validate(): user['url'] = request.POST['url'] user['bio'] = request.POST['bio'] user.save() - return redirect(request, "index", user=user.username) + return redirect(request, "index", user=user['username']) return render_to_response( request, diff --git a/mediagoblin/templates/mediagoblin/edit/edit_profile.html b/mediagoblin/templates/mediagoblin/edit/edit_profile.html index 9f6667fd..63bf013f 100644 --- a/mediagoblin/templates/mediagoblin/edit/edit_profile.html +++ b/mediagoblin/templates/mediagoblin/edit/edit_profile.html @@ -20,7 +20,7 @@ {% import "/mediagoblin/utils/wtforms.html" as wtforms_util %} {% block mediagoblin_content %} -

Edit details for {{ user }}

+

Edit details for {{ user['username'] }}

Submit an item - Edit profile + Edit profile

{% else %} -- 2.25.1