Fraction display and form fields for Django
Reason this release was yanked:
I just goofed up versioning stuff
Project description
Fraction display and form fields for Django
Documentation
The full documentation is at https://django-fractions.readthedocs.org.
Quickstart
Install django-fractions:
pip install django-fractions
Add djfractions to settings.INSTALLED_APPS
Then use it in a project:
import djfractions
In templates:
{% load fractions %} {% display_fraction 1.25 %}
In Forms:
from djfractions.forms import DecimalFractionField from django import forms class MyForm(forms.Form): a_fraction = DecimalFractionField()
Features
Template tag for displaying float and Decimal values as fractions including mixed numbers
DecimalFractionField form field which handles input such as “1/4”, “1 1/2”, “1 and 1/2”, and converts to a decimal.Decimal instance
TODO
Add unicode_fraction template tag to display the unicode fraction entity if available
forms.FloatDecimalField to return a float rather than Decimal
forms.SplitFractionWidget for having separate numerator and denominator form fields
forms.SplitMixedFractionWidget for handling mixed number fractions with separate fields
models.DecimalBackedFractionField() to store a Decimal value but return/accept it as a fraction
models.FloatBackedFractionField() to store a Decimal value but return/accept it as a fraction
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_fractions-4.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecb33399d4df509866a7812b7c282bf3964844c8e6860ed560fd4375fc2030f0 |
|
MD5 | b3197bb1d766c049c60e58bc58515e5e |
|
BLAKE2b-256 | df0260881402825e131d393afbb7f8fc20bec87a1ea2806d8f9ee494b7073c8e |