Skip to main content

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.

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.

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.

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.

Metadata

Release files for django-starfield 1.0.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-starfield 1.0.post2
File Size Uploaded
django-starfield-1.0.post2.tar.gz 10.1 kB Details

Release files / django-starfield-1.0.post2.tar.gz

Download URL django-starfield-1.0.post2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9bbc59870b958b439a2e52e3d44592ef6d80af4d57b36528292274c499f7df91
BLAKE2b-256 checksum
How to use checksums
1fc4d9a101f5c418233e52f7d77806585ba96f0026a5f753738e85ab680fd5f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.1+

Release history Release notifications | RSS feed

This release

1.0.post2 This release

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page