Commit c6a0f0a1 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Added feedback processing.

parent 43d263c5
from website.models import Question, Comment, Reply
from django import forms
from django.db import models
from django.forms import ModelForm, Textarea
......@@ -26,3 +27,7 @@ class ReplyForm( ModelForm ):
fields = ('text',)
exclude = ('user','date','parent')
localized_fields = ('date',)
class FeedbackForm( forms.Form ):
text = forms.CharField(
widget=forms.Textarea(attrs={'class':'form-control'}),max_length=1000)
from website.models import Question, Comment, Reply
from website.forms import QuestionForm, CommentForm, ReplyForm
from website.forms import QuestionForm, CommentForm, ReplyForm, FeedbackForm
from django.conf import settings
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import render
......@@ -7,6 +7,7 @@ from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.core.mail import EmailMessage
import requests
......@@ -43,3 +44,19 @@ def index(request):
'questions' : Question.objects.all(),
},
)
@login_required
def feedback(request):
if request.method == 'POST':
form = FeedbackForm( request.POST )
if form.is_valid():
# email me
return HttpResponseRedirect('/')
else:
form = FeedbackForm()
return render_to_response('feedback.html', {
'form' : form,
},
RequestContext(request),
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment