{ "info": { "author": "Takeflight", "author_email": "liam@takeflight.com.au", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "===============\nwagtailpolls\n===============\n\nA plugin for Wagtail that provides polling functionality.\n\nInstalling\n==========\n\nInstall using pip::\n\n pip install wagtailpolls\n\nIt works with Wagtail 1.3 and upwards.\n\nUsing\n=====\n\nAdd ``wagtailpolls`` to your ``INSTALLED_APPS``.\n\nEnsure you add the line ``from wagtailpolls.views.vote import vote`` to your ``urls.py`` and include the URL ``url(r'^vote/(?P.*)/$', vote, name='wagtailpolls_vote')``.\n\nDefine a foreign key referring to ``wagtailpolls.Poll`` and use the ``PollChooserPanel``:\n\n.. code-block:: python\n\n from django.db import models\n from wagtailpolls.edit_handlers import PollChooserPanel\n from wagtail.wagtailadmin.edit_handlers import FieldPanel\n\n class Content(Page):\n body = models.TextField()\n poll = models.ForeignKey(\n 'wagtailpolls.Poll',\n null=True,\n blank=True,\n on_delete=models.SET_NULL\n )\n\n content_panels = [\n FieldPanel('body', classname=\"full\"),\n PollChooserPanel('poll'),\n ]\n\n\nThen, in your editor, ensure that you have added some polls in the polls section in wagtail admin. You will be able to select a poll from there accessable in the template as you would expect.\n\nTemplating & Display\n====================\nThere are many ways in which you may want to display your poll. ``wagtailpolls`` comes with a template tag to assist with this, as well as certain attributes accessible via templating to render each question as a form. Here is an example using all of the tools provided:\n\n.. code-block:: html\n\n {% extends \"layouts/page.html\" %}\n {% load wagtailpolls_tags %}\n {% block content %}\n

{{ self.title }}

\n
\n {% if self.poll %}\n
\n {% csrf_token %}\n {{self.poll.form}}\n

\n \n
\n {% else %}\n No polls added to this page yet!\n {% endif %}\n {% endblock %}\n\nAs shown, the ``{% vote %}`` template tag will need to be passed a poll instance to function correctly. You will also need to ``{% load wagtailpolls_tags %}`` at the top of the file where this template tag is used.\nThe poll can be rendered with all questions using ``.form`` at the end. ``.form_as_ul`` and all other form types will also work.\n\nIf you do select a poll for a page, no fields will display on the form and, upon voting, a message stating that there is no poll to vote on will be displayed.\n\nVoting\n======\nWhen a vote has been submitted, the server will return a ``JsonResponse`` something like:\n\n.. code-block:: json\n\n {\"total_votes\": 11, \"total_questions\": 3, \"poll\": \"Test Poll\", \"votes\": {\"Nah\": 10, \"Yeah\": 1, \"Maybe\": 0}}\n\nWith javascript, this data can be used to create a frontend for your poll to your own liking.\n\nThe voting form also performs some validation. If the voting form is unable to obtain your IP it will return something like:\n\n.. code-block:: json\n\n {\"poll\": \"Test Poll\", \"total_questions\": 3, \"total_votes\": 11, \"votes\": {\"Yeah\": 1, \"Maybe\": 0, \"Nah\": 10}, \"form_error\": {\"__all__\": [\"Sorry, we were not able to obtain your ip address\"]}}\n\nThere is also a ``WAGTAILPOLLS_VOTE_COOLDOWN`` which is set in your settings. This will only allow users on the same IP to vote at an interval of your choosing. If this is caught, the error will be present in the ``JsonResponse`` much like the error above.\n\nAdditionally, information will be added to the django session (basically cookies will be set) that will help make sure devices are not able to vote twice. When a vote is rejected due to this reason, the vote simply won't register with no error being returned in the ``JsonResponse``.\n\nSettings\n========\n\nThe following settings can to be set in your ``settings.py`` file.\n\n``WAGTAILPOLLS_VOTE_COOLDOWN`` `This is to be an integer representing minutes, the default is 10 minutes.`\n\n``WAGTAILPOLLS_VOTE_REQUIRE_PERMS`` `A string or list of strings representing the permissions to vote, aka. 'wagtailadmin.access_admin'`\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/takeflight/wagtailpolls", "keywords": "", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "wagtailpolls", "package_url": "https://pypi.org/project/wagtailpolls/", "platform": "", "project_url": "https://pypi.org/project/wagtailpolls/", "project_urls": { "Homepage": "https://github.com/takeflight/wagtailpolls" }, "release_url": "https://pypi.org/project/wagtailpolls/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "A polling plugin for the Wagtail CMS", "version": "0.3.0" }, "last_serial": 3530452, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "be77259243f61d7c241eaa521ed29f08", "sha256": "e8d861bb2a82c03ec1ec39c821ce883901f4ba216b9baba3304a42ba4fcbd58b" }, "downloads": -1, "filename": "wagtailpolls-0.1.2.tar.gz", "has_sig": false, "md5_digest": "be77259243f61d7c241eaa521ed29f08", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11761, "upload_time": "2015-11-27T03:22:31", "url": "https://files.pythonhosted.org/packages/cd/12/52f927cac023ecca67801c202cafc211ed2aa7d60c5252332b7dfdc94d38/wagtailpolls-0.1.2.tar.gz" } ], "0.1.3": [], "0.1.4": [ { "comment_text": "", "digests": { "md5": "13f7745e7ca4b890455948223a356573", "sha256": "70ed88a6858b0bdd17da9bd8afa8789270a1f75621f2bbff44182db2c01280fc" }, "downloads": -1, "filename": "wagtailpolls-0.1.4.tar.gz", "has_sig": false, "md5_digest": "13f7745e7ca4b890455948223a356573", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13763, "upload_time": "2016-08-31T02:40:44", "url": "https://files.pythonhosted.org/packages/93/6b/0f83b6a8436b398b960cc26e83e18baf0b472a904fe1c04a94e19fc2ceaa/wagtailpolls-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "cdbd8a1bc661206cc58da94ed1d26a32", "sha256": "8c8d5c6d34138548a5432f3df3f47a78339d563f87ca68ef318bfc8e724dc46d" }, "downloads": -1, "filename": "wagtailpolls-0.2.0.tar.gz", "has_sig": false, "md5_digest": "cdbd8a1bc661206cc58da94ed1d26a32", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14430, "upload_time": "2016-11-07T01:25:18", "url": "https://files.pythonhosted.org/packages/f0/b5/3e7e6ab04d3c05e3bc9d53ff20908e86ef78dc0ee0f9e0d4764d7257ebf3/wagtailpolls-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "236ef5ed69e45668a9db509818158ff7", "sha256": "bfa5855c6212997937049caa28ee929d9fb56beadedd686148e1a66904f43b70" }, "downloads": -1, "filename": "wagtailpolls-0.2.1.tar.gz", "has_sig": false, "md5_digest": "236ef5ed69e45668a9db509818158ff7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18713, "upload_time": "2017-01-24T03:02:54", "url": "https://files.pythonhosted.org/packages/0d/3f/74e5bb5bada45fb008901dc84e058a80663d9adc479cd0daa6655412dae7/wagtailpolls-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "4470141847c0604e1b76185fe27023c0", "sha256": "20695a9fe464d4f16b263e0195e8f55bb1e4b9eba38953b063da421a82b32706" }, "downloads": -1, "filename": "wagtailpolls-0.3.0.tar.gz", "has_sig": false, "md5_digest": "4470141847c0604e1b76185fe27023c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19128, "upload_time": "2017-05-29T06:17:43", "url": "https://files.pythonhosted.org/packages/c1/92/d40b00dd8d62c43402d26b6074455adf13a02008ac0352995e2f6a33d7d4/wagtailpolls-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4470141847c0604e1b76185fe27023c0", "sha256": "20695a9fe464d4f16b263e0195e8f55bb1e4b9eba38953b063da421a82b32706" }, "downloads": -1, "filename": "wagtailpolls-0.3.0.tar.gz", "has_sig": false, "md5_digest": "4470141847c0604e1b76185fe27023c0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19128, "upload_time": "2017-05-29T06:17:43", "url": "https://files.pythonhosted.org/packages/c1/92/d40b00dd8d62c43402d26b6074455adf13a02008ac0352995e2f6a33d7d4/wagtailpolls-0.3.0.tar.gz" } ] }