Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19120 closed Cleanup/optimization (fixed)

better document common behavior of readonly_fields and list_display

Reported by: Daniele Procida Owned by: nobody
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

I was stunned to find that I could use a model's method as a readonly_field in admin. There doesn't seem to be any hint of this in the documentation - if there is, I have missed it.

It's a really useful bit of functionality, and can give valuable feedback to the user about the current state of the object they are editing, so I am quite surprised not to see it mentioned and explained more fully.

Also, although https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.fields says of it "New in Django 1.4: Please see the release notes" there's no mention of readonly_fields at https://docs.djangoproject.com/en/dev/releases/1.4/.

Finally, https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields doesn't mention "New in Django 1.4" - should it?

If I have understood this situation correctly, I'm happy to do some work on the relevant documentation.

Change History (6)

comment:1 by Preston Holmes, 12 years ago

Easy pickings: set
Summary: readonly_fields poorly documentedbetter document common behavior of readonly_fields and list_display
Triage Stage: UnreviewedAccepted
Version: 1.4master

Thanks for offering feedback on the documentation.

readonly_fields were actually introduced in 1.2 - for 1.5 we removed notices for things added/changed in < 1.3

The behavior of using a method is explained in https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

and the current readonly_field docs say: This option behaves nearly identical to ModelAdmin.list_display. - perhaps this could be more specific or clearer - so open to some rephrasing.

comment:2 by Daniele Procida, 12 years ago

OK, I will see what I can come up with.

comment:3 by Daniele Procida, 12 years ago

I have made a pull request: https://github.com/django/django/pull/459

comment:4 by Tim Graham, 12 years ago

Has patch: set

comment:5 by Tim Graham <timograham@…>, 12 years ago

Resolution: fixed
Status: newclosed

In d1de7596b207b3a7dea8203334ef1739db3b1c94:

Fixed #19120 - Added an example of using ModelAdmin methods for read-only fields.

Thanks Daniele Procida for the patch.

comment:6 by Tim Graham <timograham@…>, 12 years ago

In 75fb8f433fc0bc64fed0b8dcc540f7a3544f9aa4:

[1.5.X] Fixed #19120 - Added an example of using ModelAdmin methods for read-only fields.

Thanks Daniele Procida for the patch.

Backport of d1de7596b2 from master

Note: See TracTickets for help on using tickets.
Back to Top