mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #12481: Updated admin validation code to not reject non-editable fields in readonly_fields, since these are handled fine by the display code itself. Thanks lashni and Alex.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
18
tests/regressiontests/admin_validation/tests.py
Normal file
18
tests/regressiontests/admin_validation/tests.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin.validation import validate
|
||||
from django.test import TestCase
|
||||
|
||||
from models import Song
|
||||
|
||||
|
||||
class ValidationTestCase(TestCase):
|
||||
def test_readonly_and_editable(self):
|
||||
class SongAdmin(admin.ModelAdmin):
|
||||
readonly_fields = ["original_release"]
|
||||
fieldsets = [
|
||||
(None, {
|
||||
"fields": ["title", "original_release"],
|
||||
}),
|
||||
]
|
||||
|
||||
validate(SongAdmin, Song)
|
||||
Reference in New Issue
Block a user