def email_content(request, content_type=None, content_id=None):
    """
    Allows users to e-mail content to other people.
    """
    site = Site.objects.get_current()
                
    if request.method == 'POST':
        form = ContentEmailForm(request.POST)
    else:
        form = ContentEmailForm({
            'content_type': content_type,
            'content_id': content_id,
            'sender_email': 'from@email.com',
            'recipient_email': 'to@email.com'
        })
    if form.is_valid():
        try:
            if form.cleaned_data['content_type'] == 'article':
                object = Article.get_published.filter(section__publication__site=site).get(id=form.cleaned_data['content_id']) 
#            elif form.cleaned_data['content_type'] == 'blog_entry':
#                object = Entry.get_published.filter(blog__section__publication__site=site).get(id=form.cleaned_data['content_id'])
            else:
                raise Http404
        except ObjectDoesNotExist:
            raise Http404

    if request.method == 'POST':
        # Check to make sure they filled in addresses instead of using our
        # placeholders.
        if form.cleaned_data['sender_email'] == 'from@email.com':
            # Return the form with everything still filled in except
            # sender_email. This will cause an error message to show up next to
            # that field asking for a valid address.
            form = ContentEmailForm({
                'sender_name': form.cleaned_data['sender_name'],
                'recipient_name': form.cleaned_data['recipient_name'],
                'recipient_email': form.cleaned_data['recipient_email'],
                'note': form.cleaned_data['note'],
                'content_type': form.cleaned_data['content_type'],
                'content_id': form.cleaned_data['content_id']
            })
        elif form.cleaned_data['recipient_email'] == 'to@email.com':
            # Return the form with everything still filled in except
            # recipient_email. This will cause an error message to show up next
            # to that field asking for a valid address.
            form = ContentEmailForm({
                'sender_name': form.cleaned_data['sender_name'],
                'sender_email': form.cleaned_data['sender_email'],
                'recipient_name': form.cleaned_data['recipient_name'],
                'note': form.cleaned_data['note'], 
                'content_type': form.cleaned_data['content_type'],
                'content_id': form.cleaned_data['content_id']
            })
        else:
            email_context = {
                'sender_name': form.cleaned_data['sender_name'],
                'sender_email': form.cleaned_data['sender_email'],
                'recipient_name': form.cleaned_data['recipient_name'],
                'recipient_email': form.cleaned_data['recipient_email'],
                'note': form.cleaned_data['note'],
                'object': object
            }
            render_email_and_send(context=email_context, message_template='core/email_content.txt', subject='%s: E-mail from themaneater.com' % strip_tags(object.title), recipients=[email_context['recipient_email']], sender=email_context['sender_email'])
            return HttpResponseRedirect('/thanks/')
            
    page = {
        'form': form,
        'object': object
    }

    return render_to_response('core/email_content.html', page, context_instance=RequestContext(request))
dataset/ETHPy150Open albatrossandco/brubeck_cms/brubeck/core/emailing/views.py/email_content/original