Skip to main content

A concrete poll app allowing CRUD functionality in the admin and front-end.

Project description

django-poll
-----------
1. django-admin.py startproject project
2. Configure your database in your settings file:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'project.db',
}
}

3. Install the package to your python site-packages folder or just use it as a module in your project.
4. Add 'polls' to INSTALLED_APPS in your settings file.
5. Install django-coffee to your python site-packages folder or just use it as a module in your project.
6. Add 'django.contrib.admin' to INSTALLED_APPS in your settings file.
7. Configure yourt settings file further:
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.request',
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages'
)
8. In settings.py remember to configure LOGIN_URL
9. python manage.py syncdb --settings=project.settings
10. In your projects urls add the following code:
from django.contrib import admin
admin.autodiscover()

from polls import urls as poll_urls

urlpatterns = patterns('',
...
url(r'^poll/', include(poll_urls)),
url(r'^admin/', include(admin.site.urls)),
...
)

11. python manage.py runserver --settings=project.settings
12. http://127.0.0.1:8000/admin, login first
13. In the admin you'll see the polls app.
14. While logged in go to, http://127.0.0.1:8000/poll and add a poll.
15. Goto, http://www.jqplot.com/ and download jqplot. Then add it to you static js directory only the files needed as shown in polls/results.html.
16. Add the optional POLL_ANONYMOUS_VOTING_ENABLED = True in your settings file, flag to incorporate Anonymous voting on your system. Tracking of Anonymous votes will be done in next release.
When thjis flag is added can also add the following in the settings file:
1. SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies", to choose what session engine you want to use to see whether an anonymous user has voted or not.
2. POLL_ANONYMOUS_SESSION_AGE = 3*24*60*60, this will set the expiration age to 3 days before a anonymous user can vote again, if not supplies default to 0.
17. Run syncdb again when upgrading rather than re-installing, to get the AnonymousUserChoice model in working.
18. Make sure to download bootstrap and add the necessary files to base_site.html.
19. If you need to make use of a sign-in, sign-up package, django-user 0.0.2 is ideal.
20. You can now also view charts in the admin.
21. Add optional customizable messages to your settings file, POLL_MESSAGE_ADD, POLL_MESSAGE_UPDATE, POLL_MESSAGE_VOTE, POLL_MESSAGE_VOTE_ERROR_CHOICE_SELECTION, POLL_MESSAGE_VOTE_ERROR_ALREADY_VOTED.
22. Django 1.5.1 compatible
23. See http://pythonhosted.org/django-poll, for a showcase


Changelog
---------
0.0.3
Minor cleanup
Minor bug fix. Set proper message when no option is selected when voting on poll

0.0.4
Minor tags and methods included with showcase in templates

0.1.0
JQPLOT integration

0.1.1
Anonymous voting and PEP 8

0.1.2
Anonymous voting using sessions cookies to determine whether an anonymous user has voted or not.
Tracking of Anonymous user votes.

0.1.3
django-poll now bootstrapped! Just a simple implementation.

0.1.4
Charts in the admin

0.1.5
Optional customizable messages

0.2.0
Depends now on django-coffee.

0.2.1
Detection of checkboxes + radio inputs with django-coffee.

0.2.2
Depends now on django-coffee templates.

0.2.3
Ajax implemenation of voting

0.2.4
Ajax messages fixes, if ajax don't work for you just remove ajax script.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-polls-0.2.4.tar.bz2 (39.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page