Code

Changes between Version 37 and Version 38 of RowLevelPermissions


Ignore:
Timestamp:
11/23/06 20:07:07 (7 years ago)
Author:
adrian
Comment:

Finished editing the page

Legend:

Unmodified
Added
Removed
Modified
  • RowLevelPermissions

    v37 v38  
    163163}}} 
    164164 
    165 Row-level permissions can be edited in the admin interface, on the change form for each object with row-level permissions enabled is a link beside History to edit row level permissions. To edit row level permissions, you must have the change RLP permission and change permission on the object. To add row level permissions, you must have the add RLP permisison and change permission on the object. 
    166  
    167 By default, all instances of a model are shown to a user when they access the change list for a model. To turn off this behaviour, you must set the ''show_all_rows'' admin option to false. Doing this will increase the number of database queries made to the server, which is why the default option is that all rows are shown. An example: 
    168  
    169 {{{ 
    170 #!python 
    171 ... 
     165Row-level permissions can be edited in the admin interface. On the change form for each object with row-level permissions enabled is a link beside History to edit row-level permissions. To edit row-level permissions, you must have the "change RLP" permission ''and'' change permission on the object. To add row-level permissions, you must have the "add RLP" permisison ''and'' change permission on the object. 
     166 
     167By default, all instances of a model are shown to a user when they access the change list for a model. To turn off this behavior, set the {{{show_all_rows}}} {{{class Admin}}} option to {{{False}}}. Doing this will increase the number of database queries made to the server, which is why the default option is that all rows are shown. Example: 
     168 
     169{{{ 
     170#!python 
    172171class Mineral(models.Model): 
    173 ...     
     172    # ... 
    174173    class Admin: 
    175174        show_all_rows = False 
     
    177176    class Meta: 
    178177        row_level_permissions = True 
    179 ... 
    180 }}} 
    181  
    182 === Accessing Row Level Permissions from a Model === 
    183  
    184 The relation name for row level permissions from a model is "row_level_permissions", this will return all row level permissions related to the instance of the object. For example, this will return all row level permissions related to the object quartz: 
    185 {{{ 
    186 #!python 
    187 ... 
     178}}} 
     179 
     180=== Accessing row-level permissions from a model === 
     181 
     182Use the {{{row_level_permissions}}} attribute on a model object to retrieve all row-level permissions related to the instance of the object. For example, this will return all row-level permissions related to the object {{{quartz}}}: 
     183 
     184{{{ 
     185#!python 
    188186rlp_list = quartz.row_level_permissions.all() 
    189 ... 
    190 }}} 
    191  
    192 === Accessing the Owner and Model of a Row Level Permission === 
    193  
    194 To return the owner of a row level permission use the attribute "owner". For example: 
    195 {{{ 
    196 #!python 
    197 ... 
     187}}} 
     188 
     189=== Accessing the owner and model of a row-level permission === 
     190 
     191To return the owner of a row-level permission, use the {{{owner}}} attribute. For example: 
     192 
     193{{{ 
     194#!python 
    198195user = row_level_permission.owner 
    199 ... 
    200 }}} 
    201  
    202 To return the instance of a row level permission use the attribute "model". For example: 
    203 {{{ 
    204 #!python 
    205 ... 
     196}}} 
     197 
     198To return the instance of a row-level permission, use the {{{model}}} attribute. For example: 
     199 
     200{{{ 
     201#!python 
    206202object = row_level_permission.model 
    207 ... 
    208 }}} 
    209  
    210 == Implementation Notes == 
    211  
    212 Please see RowLevelPermissionsDeveloper for more information on how row level permissions are implemented. 
    213  
    214 == Known Bugs == 
    215  * Connecting more then one "owner" to the RLP model causes a M2M conflict, this is a bug with the generic relation code. Work around for now is to rename the related_name for each different owner. - ''This is a bug with generic relations, see ticket #2573'' 
    216  * Row level permissions can not have row level permissions enabled 
    217  * Error message in admin interface is displayed with a checkmark not an error icon 
    218  
    219  
    220 == Download == 
    221  
    222 Row Level Permissions are currently hosted in a branch on Django SVN. Please use: ''svn co http://code.djangoproject.com/svn/django/branches/per-object-permissions'' to download the current code. 
     203}}} 
     204 
     205== Implementation notes == 
     206 
     207Please see RowLevelPermissionsDeveloper for more information on how row-level permissions are implemented. 
     208 
     209== Known bugs == 
     210 
     211 * Connecting more then one "owner" to the RLP model causes a many-to-many conflict. This is a bug with the generic relation code. The workaround for now is to rename the {{{related_name}}} for each different owner. (See ticket #2573 for the bug with generic relations.) 
     212 * Row-level permission objects cannot have row-level permissions enabled. 
     213 * The error message in the admin interface is displayed with a checkmark, not an error icon. 
    223214 
    224215== Contact == 
    225216 
    226 If there are any problems, please contact myself Chris at indirecthit[at]gmail.com 
     217If there are any problems, please contact Chris, the branch maintainer, at indirecthit [at] gmail.com.