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

Release history Release notifications

This version
History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date (6.6 kB) Copy SHA256 hash SHA256 Source None Nov 2, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page