diff options
author | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-03-30 00:52:35 +0000 |
---|---|---|
committer | luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f <luxagraf@c63593aa-01b0-44d9-8516-4b9c7e931d7f> | 2010-03-30 00:52:35 +0000 |
commit | a1138b560308e043de00c2211293583515def19e (patch) | |
tree | 4094af7a024214ed2e24bc8516f253d46f65bab7 /lib/contact_form/forms.py | |
parent | df2f1df80b69ebecd85a93457f14a51bc584aa31 (diff) |
fixed styling on contact page
Diffstat (limited to 'lib/contact_form/forms.py')
-rw-r--r-- | lib/contact_form/forms.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/contact_form/forms.py b/lib/contact_form/forms.py index 830db75..dfa9ac8 100644 --- a/lib/contact_form/forms.py +++ b/lib/contact_form/forms.py @@ -143,12 +143,20 @@ class ContactForm(forms.Form): email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict, maxlength=200)), label=u'E-mail:') + subject_line = forms.CharField(widget=forms.TextInput(attrs=dict(attrs_dict, + maxlength=200)), + label=u'Subject:') body = forms.CharField(widget=forms.Textarea(attrs=attrs_dict), label=u'Message:') - #from_email = settings.DEFAULT_FROM_EMAIL + def from_email(self): + if self.cleaned_data['email']: + addy = self.cleaned_data['email'] + else: + addy = settings.DEFAULT_FROM_EMAIL + return addy - recipient_list = [mail_tuple[1] for mail_tuple in settings.MANAGERS] + recipient_list = [mail_tuple[1] for mail_tuple in settings.CONTACT] subject_template_name = "contact_form/contact_form_subject.txt" @@ -177,11 +185,14 @@ class ContactForm(forms.Form): self.get_context()) return ''.join(subject.splitlines()) + + + + def get_context(self): if not self.is_valid(): raise ValueError("Cannot generate Context from invalid contact form") if self._context is None: - self.cleaned_data['site_name'] = settings.SITE_NAME self._context = RequestContext(self.request, dict(self.cleaned_data, site=Site.objects.get_current())) @@ -196,10 +207,6 @@ class ContactForm(forms.Form): message_dict[message_part] = callable(attr) and attr() or attr return message_dict - def from_email(self): - addy = self.cleaned_data['email'] - return addy - def save(self, fail_silently=False): """ Builds and sends the email message. |