- send_mail(u'[WolneLektury] ' +
- ugettext(u'Thank you for your suggestion.'),
- ugettext(u"""\
-Thank you for your comment on WolneLektury.pl.
-The suggestion has been referred to the project coordinator.""") +
-u"""
-
---
-""" + ugettext(u'''Message sent automatically. Please do not reply.'''),
- 'no-reply@wolnelektury.pl', [contact], fail_silently=True)
-
-
-class PublishingSuggestForm(forms.Form):
- contact = forms.CharField(label=_('Contact'), max_length=120, required=False)
- books = forms.CharField(label=_('books'), widget=forms.Textarea, required=False)
- audiobooks = forms.CharField(label=_('audiobooks'), widget=forms.Textarea, required=False)
-
- def clean(self, *args, **kwargs):
- if not self.cleaned_data['books'] and not self.cleaned_data['audiobooks']:
- msg = ugettext(u"One of these fields is required.")
- self._errors["books"] = self.error_class([msg])
- self._errors["audiobooks"] = self.error_class([msg])
- return super(PublishingSuggestForm, self).clean(*args, **kwargs)
+ send_noreply_mail(
+ gettext('Dziękujemy za zgłoszenie.'),
+ gettext("""\
+Dziękujemy za zgłoszenie uwag do serwisu Wolne Lektury.
+Sugestia została przekazana koordynatorce projektu."""),
+ [contact], fail_silently=True)
+
+
+class PublishingSuggestForm(NewsletterForm):
+ email_field = 'contact'
+ contact = forms.CharField(label=_('Kontakt'), max_length=120, required=False)
+ books = forms.CharField(label=_('książki'), widget=forms.Textarea, required=True)
+ ebook = forms.BooleanField(label=_('ebook'), required=False, initial=True, label_suffix='')
+ audiobook = forms.BooleanField(label=_('audiobook'), required=False, label_suffix='')
+
+ data_processing_part2 = SuggestForm.data_processing_part2
+
+ def clean(self):
+ if not self.cleaned_data['ebook'] and not self.cleaned_data['audiobook']:
+ msg = gettext("Proszę zaznaczyć co najmniej jedną opcję.")
+ self._errors['ebook'] = self.error_class([msg])
+ self._errors['audiobook'] = self.error_class([msg])
+ return super(PublishingSuggestForm, self).clean()