From d141b934be3a1b0496d422bfe9ea31ef9c079798 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Thu, 4 Feb 2016 05:57:22 +0100
Subject: [PATCH] Correct bug in change_password

---
 scipost/templates/scipost/change_password.html | 5 ++---
 scipost/views.py                               | 7 ++++---
 submissions/models.py                          | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/scipost/templates/scipost/change_password.html b/scipost/templates/scipost/change_password.html
index ee5ec1faa..269c95f68 100644
--- a/scipost/templates/scipost/change_password.html
+++ b/scipost/templates/scipost/change_password.html
@@ -4,13 +4,12 @@
 
 {% block bodysup %}
 
-{% if acknowledgement %}
+{% if ack %}
 <section>
   <h1>Your SciPost password has been successfully changed</h1>
 </section>
 
 {% else %}
-
 <section>
   <h1>Change your SciPost password</h1>
   <form action="{% url 'scipost:change_password' %}" method="post">
@@ -26,6 +25,6 @@
   <p>{{ errormessage }}</p>
   {% endif %}
 </section>
-{% endif acknowledgement %}
+{% endif %}
 
 {% endblock bodysup %}
diff --git a/scipost/views.py b/scipost/views.py
index 49f5d2fee..c5ff388ff 100644
--- a/scipost/views.py
+++ b/scipost/views.py
@@ -304,11 +304,12 @@ def change_password(request):
                 return render(request, 'scipost/change_password.html', {'form': form, 'errormessage': 'Your new password entries must match'})
             request.user.set_password(form.cleaned_data['password_new'])
             request.user.save()
-            context = {'acknowledgement': True, 'form': PasswordChangeForm()}
-            return render(request, 'scipost/change_password.html', context)
+            ack = True
+        context = {'ack': True, 'form': form}
     else:
         form = PasswordChangeForm()
-    return render (request, 'scipost/change_password.html', {'form': form})
+        context = {'ack': False, 'form': form}
+    return render (request, 'scipost/change_password.html', context)
 
 
 def reset_password_confirm(request, uidb64=None, token=None):
diff --git a/submissions/models.py b/submissions/models.py
index 8fa225e48..cd5ea8398 100644
--- a/submissions/models.py
+++ b/submissions/models.py
@@ -126,8 +126,8 @@ class Report(models.Model):
     weaknesses = models.TextField()
     report = models.TextField()
     requested_changes = models.TextField(verbose_name="requested changes")
-    formatting = models.SmallIntegerField(choices=QUALITY_SPEC, blank=True, default=0, verbose_name="Quality of paper formatting")
-    grammar = models.SmallIntegerField(choices=QUALITY_SPEC, blank=True, default=0, verbose_name="Quality of English grammar")
+    formatting = models.SmallIntegerField(choices=QUALITY_SPEC, blank=True, verbose_name="Quality of paper formatting")
+    grammar = models.SmallIntegerField(choices=QUALITY_SPEC, blank=True, verbose_name="Quality of English grammar")
     recommendation = models.SmallIntegerField(choices=REPORT_REC)
     date_invited = models.DateTimeField('date invited', blank=True, null=True)
     invited_by = models.ForeignKey(Contributor, blank=True, null=True, related_name='invited_by')
-- 
GitLab