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

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.1.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.1-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_formula_field-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 946f03f5bdc0135e4e5c833b71c57b234cd22e983ee07ea4d0380e529b5865df
MD5 b5df9d853d9320c7a807bfa476dbde5f
BLAKE2b-256 8bd6bc88516d452254b200d86f49d68b362a10b4cabafaf60f3f2a9d6b99f5fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_formula_field-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_formula_field-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6025fb307d7ce44bb5c6051484679476046318b0e6edf67fd3c262088b64ae6f
MD5 56257c92105850eec07ead6701d4a671
BLAKE2b-256 a303e5a6edcd91d2aaa55f8972583864a669bef94f6299dc0b70173952987807

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_formula_field-0.1.1-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