diff --git a/rowers/tasks.py b/rowers/tasks.py index aed1bf59..29619a05 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -385,6 +385,24 @@ def handle_sendemail_hard(workoutid, useremail, return 1 +# send email when user deletes account +@app.task +def handle_sendemail_userdeleted(name, email, debug=False, **kwargs): + fullemail = 'roosendaalsander@gmail.com' + subject = 'User account deleted' + message = 'Sander,\n\n' + message += 'The user {name} ({email}) has just deleted his account'.format( + name=name, + email=email + ) + email = EmailMessage(subject,message, + 'Rowsandall ', + [fullemail]) + + res = email.send() + + return 1 + # send email to me when an unrecognized file is uploaded @app.task def handle_sendemail_unrecognized(unrecognizedfile, useremail, diff --git a/rowers/templates/502.html b/rowers/templates/502.html index bbf6f82f..edd8094e 100644 --- a/rowers/templates/502.html +++ b/rowers/templates/502.html @@ -204,24 +204,6 @@ - diff --git a/rowers/views.py b/rowers/views.py index c341e611..74d4b9d4 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -123,7 +123,8 @@ from rowers.tasks import ( handle_sendemailnewresponse, handle_updatedps, handle_updatecp,long_test_task,long_test_task2, handle_zip_file,handle_getagegrouprecords, - handle_updatefitnessmetric + handle_updatefitnessmetric, + handle_sendemail_userdeleted, ) from scipy.signal import savgol_filter @@ -631,9 +632,16 @@ def remove_user(request): user_form = DeleteUserForm(request.POST,instance=user) if user_form.is_valid(): cd = user_form.cleaned_data - print cd + name = user.first_name+' '+user.last_name + email = user.email + + if cd['delete_user']: user.delete() + res = myqueue(queuehigh, + handle_sendemail_userdeleted, + name, email) + url = reverse(auth_views.logout_then_login) return HttpResponseRedirect(url) return render(request, "userprofile_delete.html", { diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index e8d1f0b9..86f3f1c4 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -119,7 +119,7 @@ TEMPLATES = [ 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', 'django.template.context_processors.i18n', - 'context_processors.google_analytics', +# 'context_processors.google_analytics', 'context_processors.warning_message', ], # 'loaders': [ diff --git a/templates/basebase.html b/templates/basebase.html index 3ad39b0b..6aaaac8a 100644 --- a/templates/basebase.html +++ b/templates/basebase.html @@ -26,9 +26,7 @@ {% analytical_head_top %} - {% if GOOGLE_ANALYTICS_PROPERTY_ID %} - {% include "ga.html" %} - {% endif %} +