﻿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
13233	readonly_fields doesn't work with fields not part of the model	benc	nobody	"using readonly_fields in the admin works for fields of the model
but when I add a field to the form and try to make it readonly I'm getting an error:

{{{
ImproperlyConfigured at /admin/myapp/mymodel/1/
MyModelAdmin.readonly_fields[0], 'somefield' is not a callable or an attribute of 'MyModelAdmin' or found in the model 'MyModel'.
}}}

readonly_fields is useful to show calculated fields.
I'm using it to show the sum of inline cart items.

{{{
class MyModelAdminForm(forms.ModelForm):
    class Meta:
        model = MyModel

    somefield = forms.CharField()

class MyModelAdmin(admin.ModelAdmin):
    form = MyModelAdminForm    
    readonly_fields = ('somefield',)
}}}

Thanks
"	Uncategorized	closed	contrib.admin	1.2-beta	Normal	worksforme	admin, readonly_fields		Unreviewed	0	0	0	0	0	0
