#13233: readonly_fields doesn't work with fields not part of the model
-------------------------------------------+--------------------------------
Reporter: benc | Owner: nobody
Status: reopened | Milestone:
Component: django.contrib.admin | Version: 1.2-beta
Resolution: | Keywords: admin,
readonly_fields
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Changes (by benc):
* status: closed => reopened
* resolution: wontfix =>
Comment:
Using an attribute or callable on MyModelAdmin or MyModel doesn't work.
I'm getting:
{{{
'MyModelAdmin.fieldsets[0][1]['fields']' refers to field 'somefield' that
is missing from the form.
}}}
I think that list_display implements special functionality to use an
attribute or callable that is missing from readonly_fields.
{{{
class MyModelAdminForm(forms.ModelForm):
class Meta:
model = MyModel
class MyModelAdmin(admin.ModelAdmin):
form = MyModelAdminForm
readonly_fields = ('somefield',)
def somefield(self, obj):
return 'somefield test'
fieldsets = (
(None, {
'fields': ('somefield',)
})
)
--
Ticket URL: <http://code.djangoproject.com/ticket/13233#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.