# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.mail import send_mail, mail_managers
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.mail import send_mail, mail_managers
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
contact = forms.CharField(label=_('Contact'), max_length=120, required=False)
description = forms.CharField(label=_('Description'), widget=forms.Textarea, required=True)
contact = forms.CharField(label=_('Contact'), max_length=120, required=False)
description = forms.CharField(label=_('Description'), widget=forms.Textarea, required=True)
contact = self.cleaned_data['contact']
description = self.cleaned_data['description']
suggestion = Suggestion(contact=contact, description=description, ip=request.META['REMOTE_ADDR'])
contact = self.cleaned_data['contact']
description = self.cleaned_data['description']
suggestion = Suggestion(contact=contact, description=description, ip=request.META['REMOTE_ADDR'])
%(description)s''' % {
'site': Site.objects.get_current().domain,
'url': reverse('admin:suggest_suggestion_change', args=[suggestion.id]),
%(description)s''' % {
'site': Site.objects.get_current().domain,
'url': reverse('admin:suggest_suggestion_change', args=[suggestion.id]),
-The suggestion has been referred to the project coordinator.""") +
- u'\n\n-- \n' + ugettext(u'''Message sent automatically. Please do not reply.'''),
- 'no-reply@wolnelektury.pl', [contact], fail_silently=True)
+The suggestion has been referred to the project coordinator."""),
+ [contact], fail_silently=True)
contact = forms.CharField(label=_('Contact'), max_length=120, required=False)
books = forms.CharField(label=_('books'), widget=forms.Textarea, required=True)
ebook = forms.BooleanField(label=_('ebook'), required=False, initial=True)
audiobook = forms.BooleanField(label=_('audiobook'), required=False)
contact = forms.CharField(label=_('Contact'), max_length=120, required=False)
books = forms.CharField(label=_('books'), widget=forms.Textarea, required=True)
ebook = forms.BooleanField(label=_('ebook'), required=False, initial=True)
audiobook = forms.BooleanField(label=_('audiobook'), required=False)
self._errors['ebook'] = self.error_class([msg])
self._errors['audiobook'] = self.error_class([msg])
return super(PublishingSuggestForm, self).clean()
def save(self, request):
self._errors['ebook'] = self.error_class([msg])
self._errors['audiobook'] = self.error_class([msg])
return super(PublishingSuggestForm, self).clean()
def save(self, request):
contact = self.cleaned_data['contact']
suggestion_text = self.cleaned_data['books'].strip(', \n\r')
contact = self.cleaned_data['contact']
suggestion_text = self.cleaned_data['books'].strip(', \n\r')
suggestion = PublishingSuggestion(
contact=contact, books=books,
audiobooks=audiobooks, ip=request.META['REMOTE_ADDR'])
suggestion = PublishingSuggestion(
contact=contact, books=books,
audiobooks=audiobooks, ip=request.META['REMOTE_ADDR'])
- 'url': request.build_absolute_uri(reverse('admin:suggest_suggestion_change', args=[suggestion.id])),
- 'user': str(request.user) if request.user.is_authenticated() else '',
+ 'url': request.build_absolute_uri(reverse('admin:suggest_publishingsuggestion_change', args=[suggestion.id])),
+ 'user': str(request.user) if request.user.is_authenticated else '',
-The suggestion has been referred to the project coordinator.""") +
- u"\n\n-- \n" + ugettext(u'''Message sent automatically. Please do not reply.'''),
- 'no-reply@wolnelektury.pl', [contact], fail_silently=True)
+The suggestion has been referred to the project coordinator."""),
+ [contact], fail_silently=True)