mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #20199 -- Allow ModelForm fields to override error_messages from model fields
This commit is contained in:
parent
f34cfec0fa
commit
ee77d4b253
22 changed files with 403 additions and 149 deletions
|
@ -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.'})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue