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.
- Endpoint:
POST /api/validate-rule/ - Documentation: fields/README.md
🚀 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
- INDEX.md - Complete documentation index
- INSTALL.md - Installation guide
- QUICKSTART.md - Quick start (5 min)
- MIGRATION_GUIDE.md - Migration guide
- EXAMPLES.md - Code examples
- 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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f68d6e03dcfadc0cac70ca0aef6c59fd4f730b618b4e8255555358d303e98ab
|
|
| MD5 |
b04c6755644b35b2f98353b1e0ecf7fa
|
|
| BLAKE2b-256 |
5c6bef2f76c7fc1a4f8767715d71ff493b00e1fef45a915e8c221f2fd8b4aa6e
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_rule_engine-1.0.0.tar.gz -
Subject digest:
8f68d6e03dcfadc0cac70ca0aef6c59fd4f730b618b4e8255555358d303e98ab - Sigstore transparency entry: 843994392
- Sigstore integration time:
-
Permalink:
kelsoncm/django-rule-engine@f0830266d8deb9fa5498a5c4fda5f91682f4fd13 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/kelsoncm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@f0830266d8deb9fa5498a5c4fda5f91682f4fd13 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_rule_engine-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_rule_engine-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf050de68d6ba649d046c4f22d60bba6f99653791bebaaaeb3d2c63ccfbf331a
|
|
| MD5 |
80da13bcca614afe7b6d921d9b095f8d
|
|
| BLAKE2b-256 |
11c01d9c11538247ebf6a5e6b5812a6a3c50b33bffe076cb27da1ddb92252de6
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_rule_engine-1.0.0-py3-none-any.whl -
Subject digest:
cf050de68d6ba649d046c4f22d60bba6f99653791bebaaaeb3d2c63ccfbf331a - Sigstore transparency entry: 843994411
- Sigstore integration time:
-
Permalink:
kelsoncm/django-rule-engine@f0830266d8deb9fa5498a5c4fda5f91682f4fd13 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/kelsoncm
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@f0830266d8deb9fa5498a5c4fda5f91682f4fd13 -
Trigger Event:
release
-
Statement type: