added translation text for form contact form fields
This commit is contained in:
parent
019f8705bb
commit
34dcf31b00
3 changed files with 60 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ from django import forms
|
|||
from .models import Message
|
||||
from django.template.loader import render_to_string
|
||||
from django.core.mail import EmailMultiAlternatives
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class ContactUsForm(forms.ModelForm):
|
||||
|
|
@ -16,6 +17,12 @@ class ContactUsForm(forms.ModelForm):
|
|||
'phone_number': forms.TextInput(attrs={'class': u'form-control'}),
|
||||
'message': forms.Textarea(attrs={'class': u'form-control'}),
|
||||
}
|
||||
labels = {
|
||||
'name': _('Name'),
|
||||
'email': _('Email'),
|
||||
'phone_number': _('Phone number'),
|
||||
'message': _('Message'),
|
||||
}
|
||||
|
||||
def send_email(self):
|
||||
text_content = render_to_string('emails/contact.txt', {'data': self.cleaned_data})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue