Beispiel #1
0
def contact(request):

    success = 0

    if request.method == 'POST':

        context = {
            'name': request.POST['name'],
            'email': request.POST['email'],
            'message': request.POST['message'],
        }

        success = send_templated_mail(
            'Contact form was submitted',
            None,  # Uses the default FROM email of the project
            [a[1] for a in settings.ADMINS],  # Send to all admins
            'contact',
            context)

    form = ContactForm().as_p()

    d = {
        'form': form,
        'success': success,
    }

    return render_to_response('contact_form.html',
                              d,
                              context_instance=RequestContext(request))
def contact(request):

    success = 0

    if request.method == 'POST':

        context = {
            'name': request.POST['name'],
            'email': request.POST['email'],
            'message': request.POST['message'],
        }

        success = send_templated_mail(
            'Contact form was submitted', 
            None, # Uses the default FROM email of the project
            [a[1] for a in settings.ADMINS], # Send to all admins
            'contact', 
            context
        )

    form = ContactForm().as_p()

    d = {
        'form': form,
        'success': success,
    }

    return render_to_response('contact_form.html', d,
                              context_instance=RequestContext(request))
Beispiel #3
0
def send_comment_notification(sender, instance, created=False, **kwargs):
    if created:
        submission_author = instance.chunk.file.submission.author
        site = Site.objects.get_current()
        context = Context({
            'site': site,
            'comment': instance,
            'chunk': instance.chunk
        })
        if submission_author and submission_author.email:
            to = submission_author.email
            subject = NEW_SUBMISSION_COMMENT_SUBJECT_TEMPLATE.render(context)
            send_templated_mail(
                    subject, None, (to,), 'new_submission_comment', 
                    context, template_prefix='notifications/')
        if instance.parent and instance.parent.author.email \
                and instance.parent.author != instance.author:
            to = instance.parent.author.email
            subject = NEW_REPLY_SUBJECT_TEMPLATE.render(context)
            send_templated_mail(
                    subject, None, (to,), 'new_reply', 
                    context, template_prefix='notifications/')