Changeset 1028 in main


Ignore:
Timestamp:
04/24/12 13:27:51 (7 years ago)
Author:
pcosquer
Message:

view: rewrites doc of display_object_lifecycle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/views/main.py

    r1027 r1028  
    218218def display_object_lifecycle(request, obj_type, obj_ref, obj_revi): 
    219219    """ 
    220     Manage html page which displays lifecycle of the selected object. 
    221     It computes a context dictionnary based on 
    222      
    223     .. include:: views_params.txt  
     220    Lifecycle view of the given object (a part or a document). 
     221   
     222    :url: :samp:`/object/{obj_type}/{obj_ref}/{obj_revi}/lifecycle/[apply/]` 
     223     
     224    .. include:: views_params.txt  
     225   
     226    POST requests must have a "demote" or "promote" key and must 
     227    validate the :class:`.ConfirmPasswordForm` form. 
     228    If the form is valid, the object is promoted or demoted according to 
     229    the request. 
     230 
     231    **Template:** 
     232     
     233    :file:`lifecycle.html` 
     234 
     235    **Context:** 
     236 
     237    ``RequestContext`` 
     238     
     239    ``object_lifecycle`` 
     240        List of tuples (state name, *boolean*, signer role). The boolean is 
     241        True if the state name equals to the current state. The signer role 
     242        is a dict {"role" : name of the role, "user__username" : name of the 
     243        signer} 
     244 
     245    ``is_signer`` 
     246        True if the current user has the permission to promote this object 
     247 
     248    ``is_signer_dm`` 
     249        True if the current user has the permission to demote this object 
     250 
     251    ``password_form`` 
     252        A form to ask the user password 
     253 
     254    ``cancelled_revisions`` 
     255        List of plmobjects that will be cancelled if the object is promoted 
     256     
     257    ``deprecated_revisions`` 
     258        List of plmobjects that will be deprecated if the object is promoted 
     259 
     260    ``action`` 
     261        Only for unsuccessful POST requests. 
     262        Name of the action ("demote" or "promote") that the user tries to do. 
    224263    """ 
    225264    obj, ctx = get_generic_data(request, obj_type, obj_ref, obj_revi) 
    226265    if request.method == 'POST': 
    227266        password_form = forms.ConfirmPasswordForm(request.user, request.POST) 
    228         if "demote" in request.POST: 
    229             ctx["action"] = "demote" 
    230         elif "promote" in request.POST: 
    231             ctx["action"] = "promote" 
    232267        if password_form.is_valid(): 
    233268            if "demote" in request.POST: 
     
    236271                obj.promote() 
    237272            return HttpResponseRedirect("..") 
     273        if "demote" in request.POST: 
     274            ctx["action"] = "demote" 
     275        elif "promote" in request.POST: 
     276            ctx["action"] = "promote" 
    238277    else:  
    239278        password_form = forms.ConfirmPasswordForm(request.user) 
Note: See TracChangeset for help on using the changeset viewer.