Mercurial > public > sg101
annotate contact/views.py @ 861:e4f8d87c3d30
Configure Markdown logger to reduce noise in logs.
Markdown is logging at the INFO level whenever it loads an extension.
This looks like it has been fixed in master at GitHub. But until then
we will explicitly configure the MARKDOWN logger to log at WARNING
or higher.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 01 Dec 2014 18:36:27 -0600 |
parents | 38db6ec61af3 |
children | 6ac56115e0a8 |
rev | line source |
---|---|
bgneal@819 | 1 """Views for the contact application.""" |
gremmie@1 | 2 |
bgneal@819 | 3 from django.shortcuts import redirect, render |
gremmie@1 | 4 |
gremmie@1 | 5 from contact.forms import ContactForm |
gremmie@1 | 6 from core.functions import get_full_name |
gremmie@1 | 7 |
gremmie@1 | 8 |
gremmie@1 | 9 def contact_form(request): |
bgneal@819 | 10 if request.method == 'POST': |
bgneal@819 | 11 form = ContactForm(request.POST) |
bgneal@819 | 12 if form.is_valid(): |
bgneal@819 | 13 form.save() |
bgneal@819 | 14 return redirect('contact-thanks') |
bgneal@819 | 15 else: |
bgneal@819 | 16 initial_data = {} |
bgneal@819 | 17 if request.user.is_authenticated(): |
bgneal@819 | 18 name = get_full_name(request.user) |
bgneal@819 | 19 initial_data = {'name': name, 'email': request.user.email} |
gremmie@1 | 20 |
bgneal@819 | 21 subject = request.GET.get('subject') |
bgneal@819 | 22 if subject: |
bgneal@819 | 23 initial_data['subject'] = subject |
gremmie@1 | 24 |
bgneal@819 | 25 form = ContactForm(initial=initial_data) |
gremmie@1 | 26 |
bgneal@819 | 27 return render(request, 'contact/contact_form.html', {'form': form}) |