Skip to main content

A no-frills Django form widget for rating stars

Project description

Description

This is a simple widget rendering so-called rating stars as input for an integer field. It is based solely on CSS 3, as laid out by Martin Ivanov.

Usage

Just add the Stars widget to any IntegerField in a Django form.

from django import forms
from django_starfield import Stars

class StarsExampleForm(forms.Form):
    rating = forms.IntegerField(widget=Stars)

The following aspects are configurable, both in the Django settings and when creating the widget (by passing an argument to Stars):

Aspect

Format

Default

Setting name

Argument

Number of stars

integer

5

STARFIELD_STARS

stars

Character used as star

hexadecimal codepoint

2605

STARFIELD_CODEPOINT

codepoint

Colour of stars

HTML colour

#f5b301

STARFIELD_COLOUR

colour

Please note that some browsers render some Unicode characters, especially emojis, as images, so changing the font colour will not work.

Differences

This is different from other star rating applications in that it provides only a widget returning its selction to any IntegerField. It is not a complete rating application, just a presentational widget for integer input. It is also different in that it depends only on CSS3, without any JavaScript.

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-starfield-1.0.tar.gz (6.6 kB view details)

Uploaded Source

File details

Details for the file django-starfield-1.0.tar.gz.

File metadata

  • Download URL: django-starfield-1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for django-starfield-1.0.tar.gz
Algorithm Hash digest
SHA256 885fcbf5333f5d80b1f5ae2fff57e23b95c4b9d7d7b02f6602dc041c486aeabf
MD5 a3997bd94797cb5b59381219cc3d8abc
BLAKE2b-256 dcd7a9e170207db06ea255f58d6777969b35a9690440d776b1d4f833b545d8a2

See more details on using hashes here.

Provenance

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