Skip to main content

A Likert field for Django models

Project description

django-likert-field

A Likert field for Django models. Useful for adding ratings star functionality.

Installation

This package depends on Six the Python compatibility toolkit

pip install six
pip install django-likert-field

Basic usage

Use in the same manner as a regular model field:

# models.py
from likert_field.models import LikertField
class PetShopSurvey(models.Model):
    i_like_snakes = LikertField()

# Renders in add.html
#
# jQuery star rating widget should be able to grab by 'likert-field' class
#
<label for="id_i_like_snakes">I like snakes:</label>
<input id="id_i_like_snakes" type="text" name="i_like_snakes"
 class="likert-field" />

# detail.html
#
# assume 'survey' is context object holding instance
#
{% load likert_fa_stars %}
{{ survey.i_like_snakes|fa_stars4|safe }}

# Renders in detail.html
#
# assuming one-star Likert item score
#
<i class='fa fa-star likert-star'></i> ... other stars maybe...

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-likert-field-0.0.2.tar.gz (5.0 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