Changeset 63 in main


Ignore:
Timestamp:
07/02/10 15:18:03 (10 years ago)
Author:
pcosquer
Message:

how-to : code for controller

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/code/bicycle.py

    r62 r63  
    3333 
    3434# end Bicycle 
     35 
     36# class BicycleController 
     37class BicycleController(PartController): 
     38 
     39    def revise(self, new_revision): 
     40        if new_revision == get_next_revision(get_next_revision(self.revision)): 
     41            self.details += """ 
     42            ---------------- 
     43            hello easter egg 
     44            ---------------- 
     45            """ 
     46            self.save() 
     47        return super(BicycleController, self).revise(new_revision) 
     48 
     49# end BicycleController 
     50 
  • trunk/docs/ht_add_models.rst

    r62 r63  
    147147creation form. 
    148148 
     149The complete class Bicycle 
     150=============================== 
     151 
     152.. literalinclude:: code/bicycle.py 
     153    :pyobject: Bicycle 
     154    :linenos: 
     155 
     156 
    149157syncdb 
    150158====================== 
     
    156164Controller 
    157165======================= 
     166 
     167See :mod:`~plmapp.controllers` and :ref:`how-to-add-a-controller` for details 
     168about controllers. 
     169 
     170.. literalinclude:: code/bicycle.py 
     171    :pyobject: BicycleController 
     172    :linenos: 
     173 
    158174 
    159175Tests 
  • trunk/openPLM/plmapp/controllers.py

    r61 r63  
    5959:func:`plmapp.forms.get_modification_form`. 
    6060     
     61 
     62.. _how-to-add-a-controller: 
    6163 
    6264How to add a controller 
Note: See TracChangeset for help on using the changeset viewer.