François Parmentier committed 4558e14

Add the say view.

  • Participants
  • Parent commits 3a2d116

Comments (0)

Files changed (2)

File ector/

 urlpatterns = patterns('djector.ector.views',
     (r'^$',                           'index'),
-#    (r'^say/$',                        'say'),
+    (r'^say/$',                        'say'),
     (r'^login/$',                      'login'),
     (r'^logout/$',                      'logout'),
 #    (r'^(?P<poll_id>\d+)/$',          'detail'),

File ector/

 from django.shortcuts import render_to_response, get_object_or_404
 from djector.ector.models import *
 from django.http import HttpResponseRedirect
-#from django.core.urlresolvers import reverse
+from django.core.urlresolvers import reverse
 from django.contrib import auth
+from django.template import RequestContext
 def index(request):
   return render_to_response('ector/index.html',{
   # Redirect to a success page
   return HttpResponseRedirect("/ector/")
+def say(request):
+    user    = request.user
+    entry   = request.POST['entry']
+    ector   = Ector(user=user)
+    ector.add_entry(entry)
+    #return HttpResponseRedirect(reverse('ector.views.index', args=None))
+    return HttpResponseRedirect("/ector/")