Skip to content

Instantly share code, notes, and snippets.

@vojd
Created May 29, 2012 20:49
Show Gist options
  • Save vojd/2830622 to your computer and use it in GitHub Desktop.
Save vojd/2830622 to your computer and use it in GitHub Desktop.
Django contact form view
from django.views.generic.edit import ProcessFormView
class ContactView(ProcessFormView):
form_class = ContactForm
template_name = 'contact.html'
success_url = '/thanks/'
def form_valid(self, form):
send_contact_message(form.cleaned_data['email'],
form.cleaned_data['message'])
return super(ContactView, self).form_valid(form)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment