Skip to main content

Django field and widget for rule-engine with visual editor

Project description

Django rule-engine - Field, Widget & API

This module contains custom Django fields and helper APIs for the project.

📦 Contents

RuleField - Field for Rule Engine

Specialized Django field for working with rule-engine rules, including:

  • ✨ Visual editor with syntax highlighting
  • 🔍 Dynamic frontend validation
  • 📝 Configurable JSON examples
  • ⚡ REST API for validation

Validation API

REST endpoint for dynamically validating rule-engine rules.

🚀 Quick Start

1. Import and Use

from django_rule_engine.fields import RuleField

class MyModel(models.Model):
    rule = RuleField(
        example_data={"age": 25, "status": "active"}
    )

📚 Documentation

  1. INDEX.md - Complete documentation index
  2. INSTALL.md - Installation guide
  3. QUICKSTART.md - Quick start (5 min)
  4. MIGRATION_GUIDE.md - Migration guide
  5. EXAMPLES.md - Code examples
  6. VISUAL_DEMO.py - Demonstração Visual

🎯 Implementation Example

The field is already being used in the Cohort model in coorte/models.py:

class Cohort(Model):
    name = CharField("cohort name", max_length=256, unique=True)
    rule = RuleField(
        "validation rule",
        blank=True,
        null=True,
        example_data={
            "login": "user123",
            "user": {"email": "user@example.com"},
            "name": "Zé da Silva",
            "active": True
        },
        default="login == 'user123' and user.email != 'user123@example.com'",
    )

    class Meta:
        verbose_name = _("cohort")
        verbose_name_plural = _("cohorts")
        ordering = ["name"]

    def __str__(self):
        return self.name

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_rule_engine-1.0.0.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

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

django_rule_engine-1.0.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file django_rule_engine-1.0.0.tar.gz.

File metadata

  • Download URL: django_rule_engine-1.0.0.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_rule_engine-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8f68d6e03dcfadc0cac70ca0aef6c59fd4f730b618b4e8255555358d303e98ab
MD5 b04c6755644b35b2f98353b1e0ecf7fa
BLAKE2b-256 5c6bef2f76c7fc1a4f8767715d71ff493b00e1fef45a915e8c221f2fd8b4aa6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_rule_engine-1.0.0.tar.gz:

Publisher: publish-to-pypi.yml on kelsoncm/django-rule-engine

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_rule_engine-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_rule_engine-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cf050de68d6ba649d046c4f22d60bba6f99653791bebaaaeb3d2c63ccfbf331a
MD5 80da13bcca614afe7b6d921d9b095f8d
BLAKE2b-256 11c01d9c11538247ebf6a5e6b5812a6a3c50b33bffe076cb27da1ddb92252de6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_rule_engine-1.0.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on kelsoncm/django-rule-engine

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