A no-frills Django form widget for rating stars
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.
In contrast to others (and to the original work credited above), this widget also works on browsers that do not support CSS (like text-mode browsers). In that case, it renders as basic radio buttons with numbers.
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):
|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.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size django-starfield-1.0.post1.tar.gz (6.8 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for django-starfield-1.0.post1.tar.gz