Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

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)])

Release History

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 Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate