Skip to main content

Django field for storing and evaluating formula expressions

Project description

Django Formula Field

When you want to provide placeholder columns for user to fill in based on values of the rows, you oftentimes want to have an Excel-like formula parser. This is the aim of this package, you provide a formula field and an evaluated result field.

Installation

Installation through pip: pip install django-formula-field

Getting Started

Defining an EvaluatedFormulaField is quite simple, you define a model:

from django.db import models
from django_formulafield.fields import EvaluatedFormulaField

class SampleModel(models.Model):
    formula = models.CharField(max_length=255)
    result = EvaluatedFormulaField(formula_field="formula")  

Optional parameters are:

  • max_length: behind the scenes, the evaluation is stored in a CharField
  • reevaluate_on_update: if it should update the evaluation when you update the record

Formula field can be a callable function defined on the model.

Evaluation

Evaluation is completely offloaded to the formulas and any FormulaErrors are raised

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_formula_field-0.1.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_formula_field-0.1.2-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file django_formula_field-0.1.2.tar.gz.

File metadata

  • Download URL: django_formula_field-0.1.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_formula_field-0.1.2.tar.gz
Algorithm Hash digest
SHA256 39be8c0cd3393ec94e75584516ca5bc9f70ac548f35aeceed4f019ef0e584ec5
MD5 1e20ed553da3228edb7c331b659904c0
BLAKE2b-256 a8c7fc668990b549376f6c2164fb94a8afbddc29faecf2c3f3dcf33801d4bb55

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_formula_field-0.1.2.tar.gz:

Publisher: python-publish.yml on j0hn-mc-clane/django-formulafield

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_formula_field-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_formula_field-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef5219e83aeb2aebf8e4f1361cdcea34f6f4f3dee542fe1b9e33c3443a9caf1
MD5 bdf71086eb69d3c707b51ec3671dc9a1
BLAKE2b-256 df04df1a38dd619aa075206e1b6be096cdd10a5e9161ef349b26ca43b0160cb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_formula_field-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on j0hn-mc-clane/django-formulafield

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page