Skip to main content

django-smart-validate

Smart reusable validators for Django models & forms.

django-smart-validate provides a collection of pre-built, reusable validators and a mixin for applying them easily in Django models or forms.


Features

  • Ready-to-use common validation patterns (slug, alpha-numeric, phone, email, etc.)
  • Simple API for custom regex patterns
  • Works in both Django models and forms
  • Lightweight, no extra dependencies except Django

Installation

pip install django-smart-validate

Usage In a Django Model

from django.db import models
from smart_validate.validators import SmartValidator

class MyModel(models.Model):
    user_code = models.CharField(max_length=10, validators=[SmartValidator.validator("code")])
    email = models.CharField(max_length=254, validators=[SmartValidator.email()])

In a Django Form with Mixin

from django import forms
from smart_validate.validators import SmartValidator
from smart_validate.mixins import SmartValidateMixin

class MyForm(SmartValidateMixin, forms.Form):
    name = forms.CharField()
    email = forms.CharField()

    smart_validators = {
        "name": SmartValidator.validator("alpha_numeric"),
        "email": SmartValidator.email(),
    }

Available Validators

SmartValidator.validator("alpha_numeric")

SmartValidator.validator("slug")

SmartValidator.validator("phone")

SmartValidator.validator("code")

SmartValidator.email()

Metadata

Release files for django-smart-validate 0.1.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-smart-validate 0.1.0
File Size Uploaded
django_smart_validate-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-smart-validate 0.1.0
File Interpreter ABI Platform
django_smart_validate-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / django_smart_validate-0.1.0.tar.gz

Download URL django_smart_validate-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
47935576b5c1c2cb685708fbb93101511059d9062546c47c985b6c018e0dcc75
BLAKE2b-256 checksum
How to use checksums
4986f838826b5dc373805381cffe7a2cae780cc411880939eb65ff62d2f5a47c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / django_smart_validate-0.1.0-py3-none-any.whl

Download URL django_smart_validate-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3319fd271bbfa31a1f9eb76aeb3ad32e5be6c0d9d6eb0191857a88baffe97ca6
BLAKE2b-256 checksum
How to use checksums
03a259b26f0fb0a41a18d46ab9b7bd8cab1ff6910523c66b4467e9b3411304ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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