﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
3990	readonly fields for admin	philippe.raoult@…	nobody	"This patch adds a readonly_fields attribute to the ModelAdmin class. Fields included in the list can be set in the add form but not in the change form. They will be displayed as text in the change form. It works as follows:

{{{
#!python
class TestModel(models.Model):
       dummy = models.CharField(maxlength=10)


class TestAdmin(admin.ModelAdmin):
        readonly_fields = ('dummy',)
}}}

This feature is purely admin-side and does not interact with the editable=False option. Fields marked with editable=False will not be displayed at all and they will not be part of the django.newform.forms (ie the behavior of editable is left untouched). 

How is it implemented:
If a field is in the readonly list, its widget will be set to DisplayWidget, which only prints the value (ie no <input> tag). 

Currently this might not work for all type of fields because I'm awaiting confirmation on the design and API. Once the devs are ok, I will extend the patch to work with all fields. 

note: this ticket is similar to #1714 in functionality but only modifies the admin side. Forms are not patched. 
"		closed	contrib.admin	dev		duplicate	nfa-someday	cscott@… tom@…	Accepted	1	0	0	1	0	0
