From 6004a7ede40f23bb57adc2f273790e70cc0b50ab Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Sat, 23 Sep 2017 01:03:43 +0530 Subject: [PATCH] new welcome email --- .../datacenterlight/emails/welcome_user.html | 45 +++++++++++++++++++ .../datacenterlight/emails/welcome_user.txt | 9 ++++ datacenterlight/urls.py | 12 +++-- hosting/views.py | 23 +++++++++- 4 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 datacenterlight/templates/datacenterlight/emails/welcome_user.html create mode 100644 datacenterlight/templates/datacenterlight/emails/welcome_user.txt diff --git a/datacenterlight/templates/datacenterlight/emails/welcome_user.html b/datacenterlight/templates/datacenterlight/emails/welcome_user.html new file mode 100644 index 00000000..be90f9b8 --- /dev/null +++ b/datacenterlight/templates/datacenterlight/emails/welcome_user.html @@ -0,0 +1,45 @@ +{% load static i18n %} + + + + + + + {% trans "Welcome to Data Center Light!" %} + + + + + + + + + + + + + + + + + + + + + +
+ +
+

{% trans "Welcome to Data Center Light!" %}

+
+

+ {% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.
Try now, order a VM. VM price starts from only 15CHF per month.{% endblocktrans %} +

+
+ {% trans "ORDER VM" %} +
+

Your Data Center Light Team

+
+ + + \ No newline at end of file diff --git a/datacenterlight/templates/datacenterlight/emails/welcome_user.txt b/datacenterlight/templates/datacenterlight/emails/welcome_user.txt new file mode 100644 index 00000000..59fc242b --- /dev/null +++ b/datacenterlight/templates/datacenterlight/emails/welcome_user.txt @@ -0,0 +1,9 @@ +{% load static i18n %} + +{% trans "Welcome to Data Center Light!" %} + +{% blocktrans %}Thanks for joining us! We provide the most affordable virtual machines from the heart of Switzerland.
Try now, order a VM. VM price starts from only 15CHF per month.{% endblocktrans %} + +{{ base_url }}{% url 'hosting:create_virtual_machine' %} + +Your Data Center Light Team \ No newline at end of file diff --git a/datacenterlight/urls.py b/datacenterlight/urls.py index 772e691d..8f0bf646 100644 --- a/datacenterlight/urls.py +++ b/datacenterlight/urls.py @@ -1,11 +1,17 @@ from django.conf.urls import url -from .views import IndexView, BetaProgramView, LandingProgramView, \ - BetaAccessView, PricingView, SuccessView, \ - PaymentOrderView, OrderConfirmationView, \ +from .views import ( + IndexView, BetaProgramView, LandingProgramView, BetaAccessView, + PricingView, SuccessView, PaymentOrderView, OrderConfirmationView, WhyDataCenterLightView, ContactUsView +) + +from django.views.generic import TemplateView + urlpatterns = [ + url(r'^test/$', TemplateView.as_view( + template_name='datacenterlight/emails/welcome_user.html')), url(r'^$', IndexView.as_view(), name='index'), url(r'^t/$', IndexView.as_view(), name='index_t'), url(r'^g/$', IndexView.as_view(), name='index_g'), diff --git a/hosting/views.py b/hosting/views.py index e1d2feb2..4272afe9 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -255,12 +255,31 @@ class SignupValidatedView(SignupValidateView): login_url = '' + str(_('login')) + '' section_title = _('Account activation') + user = CustomUser.objects.filter( + validation_slug=self.kwargs['validate_slug']).first() + pre_valid = user.validated if validated: message = '{account_activation_string}
{login_string} {lurl}.'.format( account_activation_string=_( "Your account has been activated."), login_string=_("You can now"), lurl=login_url) + if not pre_valid: + email_data = { + 'subject': 'Welcome to Data Center Light!', + 'to': self.request.user.email, + 'context': { + 'base_url': "{0}://{1}".format( + self.request.scheme, + self.request.get_host() + ) + }, + 'template_name': 'welcome_user', + 'template_path': 'datacenterlight/emails/', + 'from_address': settings.DCL_SUPPORT_FROM_ADDRESS, + } + email = BaseEmail(**email_data) + email.send() else: home_url = '