Add templatetags and email templates
This commit is contained in:
parent
91e7f44eed
commit
83fc4f5036
6 changed files with 164 additions and 0 deletions
59
hosting/templates/hosting/emails/user_activation.html
Executable file
59
hosting/templates/hosting/emails/user_activation.html
Executable file
|
@ -0,0 +1,59 @@
|
||||||
|
{% load static i18n %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>{% trans "Data Center Light Account Activation" %}</title>
|
||||||
|
<link rel="shortcut icon" href="{{ base_url }}{% static 'hosting/img/favicon.ico' %}" type="image/x-icon">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:300,400">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body style="margin: 0; padding: 20px 0;">
|
||||||
|
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="{{ base_url }}{% static 'hosting/img/datacenterlight.png' %}" style="max-width: 200px;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 15px;">
|
||||||
|
<h1 style="font-family: Lato, Arial, sans-serif; font-size: 25px; font-weight: 400; margin: 0;">{% trans "Data Center Light Account Activation" %}</h1>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 25px; font-size: 16px;">
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 10px; margin-top: 0;">
|
||||||
|
{% blocktrans %}You can activate your Data Center Light account by clicking <a href="{{base_url}}{{activation_link}}" style="text-decoration: none; color: #4382c8; font-weight: 400;">here</a>.{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 10px; margin-top: 0;">
|
||||||
|
{% blocktrans %}You can also copy and paste the following link into the address bar of your browser to activate your Data Center Light account.{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
<p style="color: #4382c8; line-height: 1.4; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;">
|
||||||
|
{{base_url}}{{activation_link}}
|
||||||
|
</p>
|
||||||
|
{% if account_details %}
|
||||||
|
{% url 'hosting:reset_password' as reset_password_url %}
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 10px; margin-top: 10px;">
|
||||||
|
{% trans "Your account details are as follows" %}:
|
||||||
|
</p>
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 10px; margin-top: 0;">
|
||||||
|
{% trans "Username" %} : {% trans "Your email address" %}<br/>
|
||||||
|
{% trans "Password" %} : {{account_details}}
|
||||||
|
</p>
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin-bottom: 0; margin-top: 0;">
|
||||||
|
{% blocktrans %}You can reset your password <a href="{{base_url}}{{reset_password_url}}" style="text-decoration: none; color: #4382c8; font-weight: 400;">here</a>.{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 40px; padding-bottom: 25px;">
|
||||||
|
<h3 style="font-family: Lato, Arial, sans-serif; margin: 0; font-weight: 400; font-size: 15px;">{% trans "Your Data Center Light Team" %}</h3>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
20
hosting/templates/hosting/emails/user_activation.txt
Executable file
20
hosting/templates/hosting/emails/user_activation.txt
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% trans "Data Center Light Account Activation" %}
|
||||||
|
|
||||||
|
{% blocktrans %}You can copy and paste the following link into the address bar of your browser to activate your Data Center Light account.{% endblocktrans %}
|
||||||
|
|
||||||
|
{{base_url}}{{activation_link}}
|
||||||
|
|
||||||
|
{% if account_details %}
|
||||||
|
{% url 'hosting:reset_password' as reset_password_url %}
|
||||||
|
{% trans "Your account details are as follows" %}:
|
||||||
|
|
||||||
|
{% trans "Username" %} : {% trans "Your email address" %}
|
||||||
|
{% trans "Password" %} : {{account_details}}
|
||||||
|
|
||||||
|
{% trans "You can reset your password here" %}:
|
||||||
|
{{base_url}}{{reset_password_url}}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% trans "Your Data Center Light Team" %}
|
48
hosting/templates/hosting/emails/welcome_user.html
Executable file
48
hosting/templates/hosting/emails/welcome_user.html
Executable file
|
@ -0,0 +1,48 @@
|
||||||
|
{% load static i18n %}
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>{% trans "Welcome to Data Center Light!" %}</title>
|
||||||
|
<link rel="shortcut icon" href="{{ base_url }}{% static 'hosting/img/favicon.ico' %}" type="image/x-icon">
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:300,400">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body style="margin: 0; padding: 20px 0;">
|
||||||
|
<table style="width: 100%; border-spacing: 0; border-collapse: collapse; max-width: 560px;">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="{{ base_url }}{% static 'hosting/img/datacenterlight.png' %}" style="max-width: 200px;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 15px;">
|
||||||
|
<h1 style="font-family: Lato, Arial, sans-serif; font-size: 25px; font-weight: 400; margin: 0;">{% trans "Welcome to Data Center Light!" %}</h1>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 25px; font-size: 16px;">
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;">
|
||||||
|
{% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
<p style="line-height: 1.75; font-family: Lato, Arial, sans-serif; font-weight: 300; margin: 0;">
|
||||||
|
{% blocktrans %}Try now, order a VM. VM price starts from only 11.5 CHF per month.{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 30px;">
|
||||||
|
<a class="btn" href="{{ base_url }}{% url 'hosting:create_virtual_machine' %}" style="font-family: Lato, Arial, sans-serif; text-decoration: none; background-color: #1596da; color: #fff; padding-top: 10px; padding-bottom: 10px; padding-left: 30px; padding-right: 30px; letter-spacing: 0.5px; border-radius: 3px; display: inline-block;">{% trans "ORDER VM" %}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="padding-top: 40px; padding-bottom: 25px;">
|
||||||
|
<h3 style="font-family: Lato, Arial, sans-serif; margin: 0; font-weight: 400; font-size: 15px;">{% trans "Your Data Center Light Team" %}</h3>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
10
hosting/templates/hosting/emails/welcome_user.txt
Executable file
10
hosting/templates/hosting/emails/welcome_user.txt
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% trans "Welcome to Data Center Light!" %}
|
||||||
|
|
||||||
|
{% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.{% endblocktrans %}
|
||||||
|
{% blocktrans %}Try now, order a VM. VM price starts from only 11.5 CHF per month.{% endblocktrans %}
|
||||||
|
|
||||||
|
{{ base_url }}{% url 'hosting:create_virtual_machine' %}
|
||||||
|
|
||||||
|
{% trans "Your Data Center Light Team" %}
|
0
hosting/templatetags/__init__.py
Normal file
0
hosting/templatetags/__init__.py
Normal file
27
hosting/templatetags/custom_tags.py
Normal file
27
hosting/templatetags/custom_tags.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from django import template
|
||||||
|
from django.urls import resolve, reverse
|
||||||
|
from django.utils.translation import activate, get_language
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=True)
|
||||||
|
def change_lang(context, lang=None, *args, **kwargs):
|
||||||
|
|
||||||
|
path = context['request'].path
|
||||||
|
url_parts = resolve(path)
|
||||||
|
|
||||||
|
url = path
|
||||||
|
cur_language = get_language()
|
||||||
|
try:
|
||||||
|
activate(lang)
|
||||||
|
url = reverse(url_parts.view_name, kwargs=url_parts.kwargs)
|
||||||
|
finally:
|
||||||
|
activate(cur_language)
|
||||||
|
|
||||||
|
return "%s" % url
|
Loading…
Add table
Reference in a new issue