Commits

Jeff Hardy committed 5fa8067

Add basic views

Comments (0)

Files changed (2)

mysite/polls/views.py

 # Create your views here.
+from django.http import HttpResponse
+
+def index(request):
+    return HttpResponse("Hello, world. You're at the poll index.")
+
+def detail(request, poll_id):
+    return HttpResponse("You're looking at poll %s." % poll_id)
+
+def results(request, poll_id):
+    return HttpResponse("You're looking at the results of poll %s." % poll_id)
+
+def vote(request, poll_id):
+    return HttpResponse("You're voting on poll %s." % poll_id)
 admin.autodiscover()
 
 urlpatterns = patterns('',
-    # Example:
-    # (r'^mysite/', include('mysite.foo.urls')),
-
-    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
-    # to INSTALLED_APPS to enable admin documentation:
-    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
-    # Uncomment the next line to enable the admin:
+    (r'^polls/$', 'mysite.polls.views.index'),
+    (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
+    (r'^polls/(?P<poll_id>\d+)/results/$', 'mysite.polls.views.results'),
+    (r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
     (r'^admin/', include(admin.site.urls)),
 )