Skip to main content

django-fractions

https://badge.fury.io/py/django-fractions.png https://github.com/jmichalicek/django-fractions/workflows/Python%20package/badge.svg

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

Cookiecutter Tools Used in Making This Package

  • cookiecutter

  • cookiecutter-djangopackage

Metadata

Release files for django-fractions 5.0.0

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-fractions 5.0.0
File Size Uploaded Provenance Actions
django-fractions-5.0.0.tar.gz 16.7 kB Without provenance Details for django-fractions-5.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-fractions 5.0.0
File Interpreter ABI Platform Actions
django_fractions-5.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for django_fractions-5.0.0-py2.py3-none-any.whl

Total release size: 32.0 kB

Release files / django-fractions-5.0.0.tar.gz

Download URL django-fractions-5.0.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
888f1ac97d6d42c07eafa99d121f2a651ae2b558428a1f28246711e48a0dde5e
BLAKE2b-256 checksum
How to use checksums
2f4b61dc357447fafa4c7596c2ee22516c83700e67ae9a4ce0a9b6a55062041d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Release files / django_fractions-5.0.0-py2.py3-none-any.whl

Download URL django_fractions-5.0.0-py2.py3-none-any.whl
Size 15.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5403c413d3b0c98a5989fd6acce2700312bf6969b29ac18f750316da10d95c69
BLAKE2b-256 checksum
How to use checksums
084f543ab24f3d93d82a3c3e45e6b6094d11960804fdb5a1f3635fea2af7bfde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.1

Security for django-fractions 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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