Beispiel #1
0
 def save(self, *args, **kwargs):
     question = super(QuestionAdminForm, self).save(*args, **kwargs)
     if self.cleaned_data.get('send_answer_email'):
         answer = self.cleaned_data['answer_email']
         subject = 'Ответ на ваш вопрос'
         pp_send_email(question.email,
                       subject,
                       strip_tags(answer),
                       None,
                       html_body=answer)
     return question
Beispiel #2
0
 def save(self, *args, **kwargs):
     message = super(MessageAdminForm, self).save(*args, **kwargs)
     if self.cleaned_data.get('answer_email') and\
             self.cleaned_data.get('answer_body'):
         answer_email = self.cleaned_data['answer_email']
         answer_body = self.cleaned_data['answer_body']
         subject = 'Ответ на ваше сообщение в модуле деньги'
         pp_send_email(answer_email,
                       subject,
                       strip_tags(answer_body),
                       None,
                       html_body=answer_body)
         message.status = 1
     return message
Beispiel #3
0
    def perform_create(self, serializer):
        message = serializer.save()

        strings = {
            'name': escape(message.name or '-'),
            'contact': escape(message.contact or '-'),
            'body': linebreaksbr(escape(message.body)),
            'url': '%s%s' % (settings.HOST,
                             reverse('admin:feedback_message_change',
                                     args=[message.id]))
        }
        subject = 'Обратная связь. Новое сообщение'
        body = 'Имя: %(name)s\nКонтакт: %(contact)s\nСообщение: %(body)s\nСсылка: %(url)s' % strings
        html = 'Имя: %(name)s<br>Контакт: %(contact)s<br>Сообщение: %(body)s<br>Ссылка: <a href="%(url)s">%(url)s</a>' % strings
        pp_send_email(settings.PROJECT_CARD_CONTACT_EMAIL,
                      subject,
                      body,
                      None,
                      html_body=html)
Beispiel #4
0
    def perform_create(self, serializer):
        question = serializer.save(status=0,
                                   answer=None,
                                   answer_date=None)

        strings = {
            'name': escape(question.name),
            'email': escape(question.email),
            'body': linebreaksbr(escape(question.body)),
            'theme': question.get_theme_display(),
            'url': '%s%s' % (settings.HOST,
                             reverse('admin:project_card_question_change',
                                     args=[question.id]))
        }
        subject = 'Новый вопрос по карте проекта'
        body = 'Имя: %(name)s\nEmail: %(email)s\nТема: %(theme)s\nВопрос: %(body)s\nСсылка: %(url)s' % strings
        html = 'Имя: %(name)s<br>Email: %(email)s<br>Тема: %(theme)s<br>Вопрос: %(body)s<br>Ссылка: <a href="%(url)s">%(url)s</a>' % strings
        pp_send_email(settings.PROJECT_CARD_CONTACT_EMAIL,
                      subject,
                      body,
                      None,
                      html_body=html)