Code

Changes between Version 2 and Version 3 of ReadOnlyAdmin


Ignore:
Timestamp:
03/23/09 15:17:34 (5 years ago)
Author:
legutierr
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ReadOnlyAdmin

    v2 v3  
    22 
    33This 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 
    45 * Inducing optional read-only behavior through permissions 
    5  * Inducing fixed read-only behavior through ModelAdmin options 
     6 * Allowing fields to be populated by the user at the time of object creation and then made un-alterable/read-only when accessed subsiquently 
    67 * Attaching fine-grained read-only permissions to fieldsets 
    78 
    89The 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). 
    911 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:  
    1114     * readonly_fields: fields otherwise listed within the fieldset that are designated as read-only. 
    1215     * 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). 
    1516 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: 
    1617   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