Reference for Polls App

The polls app is a copy of the Django tutorial with some mild PEP-8 cleanup.

polls.models

class polls.models.Choice(*args, **kwargs)[source]

Choices on a poll

class polls.models.Poll(*args, **kwargs)[source]

An individual poll to be tested

polls.views

polls.views.detail(request, poll_id, template_name='polls/detail.html')[source]

Show detail on a poll

polls.views.index(request, template_name='polls/index.html')[source]

Show a list of polls

polls.views.vote(request, poll_id, template_name='polls/detail.html')[source]

user votes on a poll

polls.tests

class polls.tests.test_models.TestPolls(methodName='runTest')[source]
test_poll_create()[source]

Can we create a poll?

  • Seems trivial now
  • But for complex systems what started out as a simple create can get complex
  • Get your test coverage up!
test_was_published_today()[source]
class polls.tests.test_views.TestPollSample(methodName='runTest')[source]
setUp()[source]
test_poll_detail()[source]

Check if the poll detail displays

test_poll_index()[source]

Check if the poll index displays

test_poll_vote()[source]

vote on a poll