Changes between Version 2 and Version 3 of ReadOnlyAdmin
- Timestamp:
- Mar 23, 2009, 5:17:34 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ReadOnlyAdmin
v2 v3 2 2 3 3 This page is intended to lay out concepts regarding a possible implementation of read-only fields in django.contrib.admin. It will specifically deal with three areas: 4 * Inducing fixed read-only behavior through ModelAdmin options 4 5 * Inducing optional read-only behavior through permissions 5 * Inducing fixed read-only behavior through ModelAdmin options6 * Allowing fields to be populated by the user at the time of object creation and then made un-alterable/read-only when accessed subsiquently 6 7 * Attaching fine-grained read-only permissions to fieldsets 7 8 8 9 The following functional aspects will be addressed by this document: 10 1. The nature of read-only widget functionality, and how to provide custom read-only functionality for custom and non-custom field types and custom and non-custom editable widgets (possibly through a registration meme). 9 11 1. The manner of read-only configuration within ModelAdmin subclasses, and read-only configuration options within ModelAdmin. 10 * Configuration will center on additional options to the fieldsets option's field_options dictionary, specifically: 12 * readonly_fields will be a general option of the ModelAdmin, and would restrict editing of any fields of the model. 13 * Configuration will also be available via additional options for fieldsets's field_options dictionary, specifically: 11 14 * readonly_fields: fields otherwise listed within the fieldset that are designated as read-only. 12 15 * permission: the name of the permission change and read permissions that can control access to this fieldset. Specifically, if this is defined, either a "change" or "read" version of this permission would need to exist for the fieldset to be rendered. An "add" permission for a user would be required for this fieldset to be editable when the object is being added. This schema would permit a set of users to add fields to an object when it is created, but subsequently only view/read that data and not modify it. A "delete" permission would not apply and would not be available. If this option is not specified or is None, then current default behavior would apply. 13 * readonly_fields will also be a general option of the ModelAdmin, and would restrict editing of any fields of the model.14 1. The nature of read-only widget functionality, and how to provide custom read-only functionality for custom and non-custom field types and custom and non-custom editable widgets (possibly through a registration meme).15 16 1. The decision process within the admin site generator that determines whether a read-only widget, an editable widget, or no widget should be included in the change screen, a process that includes: 16 17 1. in the case that a change permission exists on a model, examining readonly_fields and fieldset.readonly_fields to see if the field is required statically to be read-only