summaryrefslogtreecommitdiff
path: root/tests/model_forms/models.py
diff options
context:
space:
mode:
authorLoic Bistuer <loic.bistuer@sixmedia.com>2013-06-05 14:55:05 -0400
committerTim Graham <timograham@gmail.com>2013-06-18 08:01:17 -0400
commitee77d4b25360a9fc050c32769a334fd69a011a63 (patch)
tree1f20a040970dc53d2e4977d79fe66ea7626cd932 /tests/model_forms/models.py
parentf34cfec0fa1243b4a3b9865b961a2360f211f0d8 (diff)
downloaddjango-ee77d4b25360a9fc050c32769a334fd69a011a63.tar.gz
Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields
Diffstat (limited to 'tests/model_forms/models.py')
-rw-r--r--tests/model_forms/models.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py
index a798f9bf95..a4cf9471de 100644
--- a/tests/model_forms/models.py
+++ b/tests/model_forms/models.py
@@ -11,6 +11,7 @@ from __future__ import unicode_literals
import os
import tempfile
+from django.core import validators
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import FileSystemStorage
from django.db import models
@@ -286,3 +287,12 @@ class ColourfulItem(models.Model):
class ArticleStatusNote(models.Model):
name = models.CharField(max_length=20)
status = models.ManyToManyField(ArticleStatus)
+
+class CustomErrorMessage(models.Model):
+ name1 = models.CharField(max_length=50,
+ validators=[validators.validate_slug],
+ error_messages={'invalid': 'Model custom error message.'})
+
+ name2 = models.CharField(max_length=50,
+ validators=[validators.validate_slug],
+ error_messages={'invalid': 'Model custom error message.'})