# Path: staff/models.py
# class StaffMember(BaseStaffMember):
#     pass
# 
# Path: staff/forms.py
# class ContactForm(forms.Form):
#     """
#     A simple contact form to allow contacting the staff
#     """
#     name = forms.CharField(label=_('Your Name'))
#     email = forms.EmailField(label=_('Your Email'))
#     message = forms.CharField(label=_('Message'), widget=forms.Textarea)


from datetime import datetime
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from staff.models import StaffMember
from staff.forms import ContactForm
        from story.settings import PUBLISHED_STATUS
import json
    member = get_object_or_404(StaffMember, slug__iexact=slug, is_active=True)

    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            subject = render_to_string(
                email_subject_template,
                {'member': member}
            )
            subject = ''.join(subject.splitlines())

            message = render_to_string(
                email_body_template,
                {'name': form.cleaned_data['name'],
                'email': form.cleaned_data['email'],
                'message': form.cleaned_data['message']}
            )

            EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL,
                [member.email], headers={
                    'Reply-To': form.cleaned_data['email']
                }).send()

            return HttpResponseRedirect(success_url)
    else:
        initial = {}
        if not request.user.is_anonymous():
            initial = {'name': '%s %s' % (request.user.first_name,
                                          request.user.last_name),
                        'email': request.user.email}

# Path: staff/models.py
# class StaffMember(BaseStaffMember):
#     pass
# 
# Path: staff/forms.py
# class ContactForm(forms.Form):
#     """
#     A simple contact form to allow contacting the staff
#     """
#     name = forms.CharField(label=_('Your Name'))
#     email = forms.EmailField(label=_('Your Email'))
#     message = forms.CharField(label=_('Message'), widget=forms.Textarea)


# Path: staff/views.py
from datetime import datetime
from django.conf import settings
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from staff.models import StaffMember
from staff.forms import ContactForm
        from story.settings import PUBLISHED_STATUS
import json

    member = get_object_or_404(StaffMember, slug__iexact=slug, is_active=True)

    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            subject = render_to_string(
                email_subject_template,
                {'member': member}
            )
            subject = ''.join(subject.splitlines())

            message = render_to_string(
                email_body_template,
                {'name': form.cleaned_data['name'],
                'email': form.cleaned_data['email'],
                'message': form.cleaned_data['message']}
            )

            EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL,
                [member.email], headers={
                    'Reply-To': form.cleaned_data['email']
                }).send()

            return HttpResponseRedirect(success_url)
    else:
        initial = {}
        if not request.user.is_anonymous():
            initial = {'name': '%s %s' % (request.user.first_name,
                                          request.user.last_name),
                        'email': request.user.email}

        form = ContactForm(initial=initial)