Code

Changes between Version 11 and Version 12 of NewAdminChanges


Ignore:
Timestamp:
10/18/05 13:55:08 (9 years ago)
Author:
rjwittams
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewAdminChanges

    v11 v12  
    7373Without these changes, the new fixes will not work. It should work about as well as the trunk without these changes.  
    7474 
    75 == Manipulators == 
     75== Manipulators and inline editing == 
    7676 
    7777Manipulators have a new optional argument to their constructors: {{{follow}}}. The argument is a dictionary indicating which fields and related objects to extract in flatten_data and examine when saving the object. 
     
    8383 
    8484This is the set of fields shown by the admin.  
     85 
     86Currently, the FormWrapper must be passed edit_inline=True to gain access to these fields.  
     87This will probably be removed.  
     88 
     89examples of dictionarys to be used as {{{follow}}} arguments.  
     90 
     91Suppress the field 'name'. 
     92{{{ 
     93follow = { 
     94  'name': False, 
     95} 
     96}}} 
     97 
     98Show the editable=False field 'job' 
     99{{{ 
     100  
     101follow = { 'job' : True, } 
     102 
     103 
     104}}} 
     105 
     106Show the set of related objects in the module 'choices' 
     107{{{ 
     108follow = { 
     109   'choices': True, 
     110} 
     111 
     112}}} 
     113 
     114Show the set of related objects in the module 'choices', but suppress the 'poll' field of each choice object: 
     115{{{ 
     116 
     117  follow = { 
     118     'choices': {  
     119        'poll': False 
     120     } 
     121  } 
     122 
     123}}} 
     124 
     125Put it all together:  
     126{{{ 
     127  follow = { 
     128    'name' : False, 
     129    'job' : True, 
     130    'choices' : { 
     131       'poll' : False 
     132    } 
     133  } 
     134}}} 
     135 
     136An example of using this in a view function: 
    85137 
    86138{{{ 
     
    110162 
    111163    # Populate the FormWrapper. 
    112     form = formfields.FormWrapper(manipulator, new_data, errors, edit_inline = True) # ,----- EXTRA ARGUMENT 
     164    form = formfields.FormWrapper(manipulator, new_data, errors, edit_inline = True) # <----- EXTRA ARGUMENT 
    113165     
    114166   
     
    116168 
    117169}}} 
    118  
    119 Manipulators have a new method, {{{flatten_data()}}}. This takes the data from the existing object (or the defaults in the case of an {{{AddManipulator}}}) and turns it into a suitable form for an HTTP post. It must be called before creating the formfield wrapper is created. 
    120170 
    121171== Templates ==