slug = wtforms.TextField(
'Slug')
description = wtforms.TextAreaField('Description of this work')
+
+class EditProfileForm(wtforms.Form):
+ url = wtforms.TextField(
+ 'website URL',
+ [wtforms.validators.URL(message='Improperly formed URL')])
+ bio = wtforms.TextAreaField('bio',
+ [wtforms.validators.Length(min=0, max=500)])
'mediagoblin/edit/edit.html',
{'media': media,
'form': form})
+
+@require_active_login
+def edit_profile(request):
+
+ form = forms.EditProfileForm(request.POST,
+ url = user['url'],
+ bio = user['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 render_to_response(
+ request,
+ 'mediagoblin/edit/edit_profile.html',
+ {'user': user,
+ 'form': form})
--- /dev/null
+{#
+# GNU MediaGoblin -- federated, autonomous media hosting
+# Copyright (C) 2011 Free Software Foundation, Inc
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#}
+{% extends "mediagoblin/base.html" %}
+
+{% import "/mediagoblin/utils/wtforms.html" as wtforms_util %}
+
+{% block mediagoblin_content %}
+ <h1>Edit details for {{ user }}</h1>
+
+ <form action="{{ request.urlgen('mediagoblin.edit.profile',
+ user=user.username) }}"
+ method="POST" enctype="multipart/form-data">
+ <div class="submit_box form_box">
+ {{ wtforms_util.render_divs(form) }}
+ <div class="form_submit_buttons">
+ <input type="submit" value="submit" class="button" />
+ </div>
+ </div>
+ </form>
+{% endblock %}