Write translations and fix pep8

This commit is contained in:
Jan Tuomi
2017-10-29 12:11:15 +02:00
parent 331d4b86b9
commit c855ffc10f
5 changed files with 39 additions and 36 deletions
+1 -1
View File
@@ -121,4 +121,4 @@ class ApplicationForm(forms.ModelForm):
super(ApplicationForm, self).__init__(*args, **kwargs)
self.fields['AYY'].label = _("I'm a member of AYY")
self.fields['jas'].label = _("I want to receive a weekly newsletter")
self.fields['jas'].label = _("I want to receive a weekly newsletter")
+8 -8
View File
@@ -68,7 +68,7 @@ def application_accept(request, *args, **kwargs):
if id is not None:
application = Request.objects.get(id=id)
else:
return render(request,
return render(request,
'error.html',
{'error': _("Application missing 'id' field.")})
@@ -79,9 +79,9 @@ def application_accept(request, *args, **kwargs):
if Member.objects.filter(email=application.email).exists():
return render(request,
'error.html',
{'error': _('Email {} is already in use by a member. Application cannot be accepted.').format(application.email)})
'error.html',
{'error': _('Email {} is already in use by a member. Application cannot be accepted.').format(application.email)})
member = application.to_member()
member.save()
application.delete()
@@ -91,14 +91,14 @@ def application_accept(request, *args, **kwargs):
"register with the following info: {}"
.format(form))
notification = "{} {}.".format(_("Successfully accepted application"),
str(application))
str(application))
return HttpResponseRedirect(
'/members/list?notification={}'.format(html.escape(notification)))
except Exception as ex:
logging.exception('Exception while accepting application')
return render(request,
'error.html',
{'error': str(ex)})
'error.html',
{'error': str(ex)})
else:
logging.info(form)
return render(request,
@@ -125,7 +125,7 @@ def application_delete(request, *args, **kwargs):
application.delete()
logging.info(
"Delete application in member register with the following id: {}"
.format(id))
.format(id))
return HttpResponseRedirect(
'/members/applications?notification={}'
.format(html.escape(notification)))
+1 -1
View File
@@ -143,7 +143,7 @@ def member_update(request, *args, **kwargs):
if id is not None:
member = Member.objects.get(id=id)
else:
return render(request,
return render(request,
'error.html',
{'error': _("Member missing 'id' field.")})
logging.debug(member)