Skip to main content

Validators for Django models.

Project description

Django Model Validators

Django model validators adds a few common validators in addition to Django's [built-in validators](


Run `pip install django-model-validators`


Ensures an upload file name ends in an extension.

from django.db import models
from model_validators.validators import FileTypeValidator

class MyModel(models.Model):
even_field = models.IntegerField(validators=[FileTypeValidator('zip')])

It can also be passed a list of extensions:

from django.db import models

class MyModel(models.Model):
even_field = models.IntegerField(validators=[FileTypeValidator(['zip', 'txt', 'pdf'])])

Ensure the field value falls within the specified range.

from django.db import models
from model_validators.validators import NumericRangeValidator

class MyModel(models.Model):
rating = models.PositiveIntegerField(validators=[NumericRangeValidator(1, 10)])

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-model-validators, version 0.1a2
Filename, size File type Python version Upload date Hashes
Filename, size (6.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page