Merge branch 'master' into 12224-change-ch-vat
This commit is contained in:
commit
a38a4a86a4
6 changed files with 45 additions and 34 deletions
|
@ -31,9 +31,10 @@ class ContactView(FormView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.save()
|
print("alplora contactusform")
|
||||||
form.send_email(email_to='info@alplora.ch')
|
#form.save()
|
||||||
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
#form.send_email(email_to='info@alplora.ch')
|
||||||
|
#messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||||
return render(self.request, 'alplora/contact_success.html', {})
|
return render(self.request, 'alplora/contact_success.html', {})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,23 +63,23 @@ class ContactUsView(FormView):
|
||||||
)
|
)
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.save()
|
#form.save()
|
||||||
from_emails = {
|
#from_emails = {
|
||||||
'glasfaser': 'glasfaser@ungleich.ch'
|
# 'glasfaser': 'glasfaser@ungleich.ch'
|
||||||
}
|
#}
|
||||||
from_page = self.request.POST.get('from_page')
|
#from_page = self.request.POST.get('from_page')
|
||||||
email_data = {
|
#email_data = {
|
||||||
'subject': "{dcl_text} Message from {sender}".format(
|
# 'subject': "{dcl_text} Message from {sender}".format(
|
||||||
dcl_text=settings.DCL_TEXT,
|
# dcl_text=settings.DCL_TEXT,
|
||||||
sender=form.cleaned_data.get('email')
|
# sender=form.cleaned_data.get('email')
|
||||||
),
|
# ),
|
||||||
'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
|
# 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
|
||||||
'to': [from_emails.get(from_page, 'support@ungleich.ch')],
|
# 'to': [from_emails.get(from_page, 'support@ungleich.ch')],
|
||||||
'body': "\n".join(
|
# 'body': "\n".join(
|
||||||
["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]),
|
# ["%s=%s" % (k, v) for (k, v) in form.cleaned_data.items()]),
|
||||||
'reply_to': [form.cleaned_data.get('email')],
|
# 'reply_to': [form.cleaned_data.get('email')],
|
||||||
}
|
#}
|
||||||
send_plain_email_task.delay(email_data)
|
#send_plain_email_task.delay(email_data)
|
||||||
if self.request.is_ajax():
|
if self.request.is_ajax():
|
||||||
return self.render_to_response(
|
return self.render_to_response(
|
||||||
self.get_context_data(success=True, contact_form=form))
|
self.get_context_data(success=True, contact_form=form))
|
||||||
|
|
|
@ -835,9 +835,10 @@ class ContactView(FormView):
|
||||||
success_message = _('Message Successfully Sent')
|
success_message = _('Message Successfully Sent')
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.save()
|
print("digital glarus contactusform")
|
||||||
form.send_email()
|
#form.save()
|
||||||
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
#form.send_email()
|
||||||
|
#messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||||
return super(ContactView, self).form_valid(form)
|
return super(ContactView, self).form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@ dotenv.load_dotenv("{0}/.env".format(PROJECT_DIR))
|
||||||
|
|
||||||
from multisite import SiteID
|
from multisite import SiteID
|
||||||
|
|
||||||
|
RECAPTCHA_PUBLIC_KEY = env('RECAPTCHA_PUBLIC_KEY')
|
||||||
|
RECAPTCHA_PRIVATE_KEY = env('RECAPTCHA_PRIVATE_KEY')
|
||||||
|
|
||||||
UNGLEICH_BLOG_SITE_ID = int_env("UNGLEICH_BLOG_SITE_ID")
|
UNGLEICH_BLOG_SITE_ID = int_env("UNGLEICH_BLOG_SITE_ID")
|
||||||
SITE_ID = SiteID(default=(UNGLEICH_BLOG_SITE_ID if
|
SITE_ID = SiteID(default=(UNGLEICH_BLOG_SITE_ID if
|
||||||
UNGLEICH_BLOG_SITE_ID > 0 else 1))
|
UNGLEICH_BLOG_SITE_ID > 0 else 1))
|
||||||
|
@ -125,6 +128,7 @@ INSTALLED_APPS = (
|
||||||
'djangocms_file',
|
'djangocms_file',
|
||||||
'djangocms_picture',
|
'djangocms_picture',
|
||||||
'djangocms_video',
|
'djangocms_video',
|
||||||
|
'django_recaptcha',
|
||||||
# 'djangocms_flash',
|
# 'djangocms_flash',
|
||||||
# 'djangocms_googlemap',
|
# 'djangocms_googlemap',
|
||||||
# 'djangocms_inherit',
|
# 'djangocms_inherit',
|
||||||
|
|
|
@ -25,9 +25,10 @@ class ContactView(FormView):
|
||||||
success_message = _('Message Successfully Sent')
|
success_message = _('Message Successfully Sent')
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.save()
|
print("ungleich_page contactusform")
|
||||||
form.send_email()
|
#form.save()
|
||||||
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
#form.send_email()
|
||||||
|
#messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||||
return super(ContactView, self).form_valid(form)
|
return super(ContactView, self).form_valid(form)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
|
@ -4,6 +4,8 @@ from django.core.mail import EmailMultiAlternatives
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from django_recaptcha.fields import ReCaptchaField
|
||||||
|
|
||||||
from membership.models import CustomUser
|
from membership.models import CustomUser
|
||||||
from .models import ContactMessage, BillingAddress, UserBillingAddress
|
from .models import ContactMessage, BillingAddress, UserBillingAddress
|
||||||
|
|
||||||
|
@ -188,6 +190,7 @@ class UserBillingAddressForm(forms.ModelForm):
|
||||||
|
|
||||||
class ContactUsForm(forms.ModelForm):
|
class ContactUsForm(forms.ModelForm):
|
||||||
error_css_class = 'autofocus'
|
error_css_class = 'autofocus'
|
||||||
|
captcha = ReCaptchaField()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ContactMessage
|
model = ContactMessage
|
||||||
|
@ -206,11 +209,12 @@ class ContactUsForm(forms.ModelForm):
|
||||||
}
|
}
|
||||||
|
|
||||||
def send_email(self, email_to='info@digitalglarus.ch'):
|
def send_email(self, email_to='info@digitalglarus.ch'):
|
||||||
text_content = render_to_string(
|
pass
|
||||||
'emails/contact.txt', {'data': self.cleaned_data})
|
#text_content = render_to_string(
|
||||||
html_content = render_to_string(
|
# 'emails/contact.txt', {'data': self.cleaned_data})
|
||||||
'emails/contact.html', {'data': self.cleaned_data})
|
#html_content = render_to_string(
|
||||||
email = EmailMultiAlternatives('Subject', text_content)
|
# 'emails/contact.html', {'data': self.cleaned_data})
|
||||||
email.attach_alternative(html_content, "text/html")
|
#email = EmailMultiAlternatives('Subject', text_content)
|
||||||
email.to = [email_to]
|
#email.attach_alternative(html_content, "text/html")
|
||||||
email.send()
|
#email.to = [email_to]
|
||||||
|
#email.send()
|
||||||
|
|
Loading…
Reference in a new issue