Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Make the email confirmation mail translatable

Roland Geiderd7c78e21a12a
diff --git a/wger/core/templates/email_verification/confirm_template.html b/wger/core/templates/email_verification/confirm_template.html
index bb2125090..ce3915c7d 100644
--- a/wger/core/templates/email_verification/confirm_template.html
+++ b/wger/core/templates/email_verification/confirm_template.html
@@ -18,7 +18,6 @@
{% blocktranslate trimmed %}
{{ user.username }}, your email was verified
{% endblocktranslate %}
-
{% else %}
{% translate "Error, invalid verification token" %}
{% endif %}
diff --git a/wger/core/templates/email_verification/email_body.html b/wger/core/templates/email_verification/email_body.html
deleted file mode 100644
index 13836cf5b..000000000
--- a/wger/core/templates/email_verification/email_body.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <title>Email Confirmation</title>
-</head>
-<body>
-<h1>You are almost there, {{ user.username }}!</h1><br>
-<h2>Please click <a href="{{ link }}">here</a> to confirm your account</h2>
-<h2>The token expires on {{ expiry|time:"TIME_FORMAT" }}</h2>
-</body>
-</html>
diff --git a/wger/core/templates/email_verification/email_body.txt b/wger/core/templates/email_verification/email_body.txt
deleted file mode 100644
index deb6b475f..000000000
--- a/wger/core/templates/email_verification/email_body.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-You are almost there, {{ user.username }}!
-Please click the following link to confirm your account: {{ link }}
-The token expires on {{ expiry|time:"TIME_FORMAT" }}
diff --git a/wger/core/templates/email_verification/email_body_html.tpl b/wger/core/templates/email_verification/email_body_html.tpl
new file mode 100644
index 000000000..f86ab9f86
--- /dev/null
+++ b/wger/core/templates/email_verification/email_body_html.tpl
@@ -0,0 +1,16 @@
+{% load i18n %}
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>{% translate 'Email Confirmation' %}</title>
+</head>
+<body>
+<p>{% blocktranslate with username=user.username %}You are almost there, {{ username }}!{% endblocktranslate %}</p>
+<br>
+<p>{% blocktranslate %}Please click <a href="{{ link }}">here</a> to confirm your account{% endblocktranslate %}</p>
+<p>{% blocktranslate with time=expiry|time:"TIME_FORMAT" %}The token expires on {{ time }}{% endblocktranslate %}</p>
+
+<p><i>{% translate 'the wger Team' %}</i></p>
+</body>
+</html>
diff --git a/wger/core/templates/email_verification/email_body_txt.tpl b/wger/core/templates/email_verification/email_body_txt.tpl
new file mode 100644
index 000000000..a5f16c162
--- /dev/null
+++ b/wger/core/templates/email_verification/email_body_txt.tpl
@@ -0,0 +1,8 @@
+{% load i18n %}
+
+{% blocktranslate with username=user.username %}You are almost there, {{ username }}!{% endblocktranslate %}
+{% blocktranslate %}Please click the following link to confirm your account: {{ link }}{% endblocktranslate %}
+{% blocktranslate with time=expiry|time:"TIME_FORMAT" %}The token expires on {{ time }}{% endblocktranslate %}
+
+
+{% translate 'the wger Team' %}
diff --git a/wger/exercises/models/video.py b/wger/exercises/models/video.py
index 5835173aa..8635c121e 100644
--- a/wger/exercises/models/video.py
+++ b/wger/exercises/models/video.py
@@ -34,11 +34,17 @@ except ImportError:
from wger.exercises.models import ExerciseBase
from wger.utils.models import AbstractLicenseModel
+MAX_FILE_SIZE_MB = 100
+
def validate_video(value):
- if value.size > 1024 * 1024 * 100:
- raise ValidationError(_('Maximum file size is 100MB.'))
+ if value.size > 1024 * 1024 * MAX_FILE_SIZE_MB:
+ raise ValidationError(_('Maximum file size is %(size)sMB.') % {'size': MAX_FILE_SIZE_MB})
+
+ # Editing existing video
+ if not hasattr(value.file, 'temporary_file_path'):
+ return
if value.file.content_type not in ['video/mp4', 'video/webm', 'video/ogg']:
raise ValidationError(_('File type is not supported'))
diff --git a/wger/exercises/views/history.py b/wger/exercises/views/history.py
index af0e2b7c8..f0644a4ab 100644
--- a/wger/exercises/views/history.py
+++ b/wger/exercises/views/history.py
@@ -52,14 +52,9 @@ def overview2(request):
"""
Generic view to list the history of the exercises
"""
- context = {}
-
out = []
- history = Exercise.history.all()
- for entry in history:
+ for entry in Exercise.history.all():
if entry.prev_record:
out.append({'record': entry, 'delta': entry.diff_against(entry.prev_record)})
- context['history'] = out
-
- return render(request, 'history/list.html', context)
+ return render(request, 'history/list2.html', {'history': out})
diff --git a/wger/settings.tpl b/wger/settings.tpl
index 7bbceb8a2..195e34b1f 100644
--- a/wger/settings.tpl
+++ b/wger/settings.tpl
@@ -64,7 +64,7 @@ WGER_SETTINGS['EMAIL_FROM'] = 'wger Workout Manager <[email protected]>'
DEFAULT_FROM_EMAIL = WGER_SETTINGS['EMAIL_FROM']
# The site's domain as used by the email verification workflow
-EMAIL_PAGE_DOMAIN = 'https://wger.de/'
+EMAIL_PAGE_DOMAIN = SITE_URL
# Your twitter handle, if you have one for this instance.
#WGER_SETTINGS['TWITTER'] = ''
diff --git a/wger/settings_global.py b/wger/settings_global.py
index 30f110565..3bda57fa3 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -457,11 +457,11 @@ def email_verified_callback(user):
EMAIL_VERIFIED_CALLBACK = email_verified_callback
EMAIL_FROM_ADDRESS = WGER_SETTINGS['EMAIL_FROM']
EMAIL_MAIL_SUBJECT = 'Confirm your email'
-EMAIL_MAIL_HTML = 'email_verification/email_body.html'
-EMAIL_MAIL_PLAIN = 'email_verification/email_body.txt'
+EMAIL_MAIL_HTML = 'email_verification/email_body_html.tpl'
+EMAIL_MAIL_PLAIN = 'email_verification/email_body_txt.tpl'
EMAIL_TOKEN_LIFE = 60 * 60
EMAIL_PAGE_TEMPLATE = 'email_verification/confirm_template.html'
-EMAIL_PAGE_DOMAIN = 'https://wger.de/'
+EMAIL_PAGE_DOMAIN = 'http://localhost:8000/'
#
# Django activity stream