Commit 3ad4f353 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Fix profile saving and add success alert

parent 893ac9d9
...@@ -7,8 +7,8 @@ msgid "" ...@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-15 21:50+0200\n" "POT-Creation-Date: 2016-09-15 21:55+0200\n"
"PO-Revision-Date: 2016-09-15 21:50+0200\n" "PO-Revision-Date: 2016-09-15 21:55+0200\n"
"Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n" "Last-Translator: Thom Wiggers <thom@thomwiggers.nl>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
...@@ -311,7 +311,11 @@ msgstr "uitloggen" ...@@ -311,7 +311,11 @@ msgstr "uitloggen"
msgid "Leave the restricted area of the website." msgid "Leave the restricted area of the website."
msgstr "Verlaat het beveiligde gedeelte van de website." msgstr "Verlaat het beveiligde gedeelte van de website."
#: templates/members/edit_profile.html:31 #: templates/members/edit_profile.html:14
msgid "You're profile has been updated successfully."
msgstr "Je profiel is succesvol opgeslagen."
#: templates/members/edit_profile.html:36
msgid "save" msgid "save"
msgstr "opslaan" msgstr "opslaan"
......
...@@ -7,6 +7,13 @@ ...@@ -7,6 +7,13 @@
{% block body %} {% block body %}
<h1>{% trans "edit profile"|capfirst %}</h1> <h1>{% trans "edit profile"|capfirst %}</h1>
{% if saved %}
<div class="alert alert-success">
{% trans "You're profile has been updated successfully." %}
<button class="close" type="button"><span class="alert-icon-close"></span></button>
</div>
{% endif %}
<form method="post" class="form-horizontal span8 offset2"> <form method="post" class="form-horizontal span8 offset2">
{% csrf_token %} {% csrf_token %}
......
...@@ -135,16 +135,18 @@ def account(request): ...@@ -135,16 +135,18 @@ def account(request):
@login_required @login_required
def edit_profile(request): def edit_profile(request):
member = get_object_or_404(Member, user=request.user) member = get_object_or_404(Member, user=request.user)
saved = False
if request.POST: if request.POST:
form = MemberForm(request.POST) form = MemberForm(request.POST, instance=member)
if form.is_valid(): if form.is_valid():
saved = True
member = form.save() member = form.save()
else:
form = MemberForm(instance=member) form = MemberForm(instance=member)
return render(request, 'members/edit_profile.html', return render(request, 'members/edit_profile.html',
{'form': form}) {'form': form, 'saved': saved})
def become_a_member(request): def become_a_member(request):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment