Code

Ticket #12481: rofv1.diff

File rofv1.diff, 854 bytes (added by lashni, 4 years ago)
Line 
1Index: django/contrib/admin/validation.py
2===================================================================
3--- django/contrib/admin/validation.py  (revision 12063)
4+++ django/contrib/admin/validation.py  (working copy)
5@@ -240,6 +240,11 @@
6                 if type(fields) != tuple:
7                     fields = (fields,)
8                 for field in fields:
9+                    if field in cls.readonly_fields:
10+                        # Stuff can be put in fields that isn't actually a model field
11+                        # if it's in readonly_fields, readonly_fields will handle the
12+                        # validation of such things.
13+                        continue
14                     check_formfield(cls, model, opts, "fieldsets[%d][1]['fields']" % idx, field)
15                     try:
16                         f = opts.get_field(field)