Changes between Version 166 and Version 167 of DeveloperGuidelines


Ignore:
Timestamp:
03/21/11 03:20:44 (14 years ago)
Author:
Michael Howden
Comment:

Tutorial moved to http://eden.sahanafoundation.org/wiki/DeveloperGuidelines/Tutorial

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines

    v166 v167  
    55
    66 * [wiki:Domain Understanding the Domain]
     7 * [wiki:DeveloperGuideline/Tutorial Tutorial]
    78 * [wiki:Projects]
    89 * '''[wiki:BluePrints BluePrints]'''
     
    8687Web2Py can be extended through [http://www.web2py.com/plugins Plugins] & also has a [http://web2pyslices.com recipes site].
    8788
    88 == Tutorial ==
    89 
    90 This tutorial was given at !SahanaCamp 1.1 in Taiwan:
    91  * http://www.slideshare.net/AidIQ/sahana-introduction-to-the-code-v2
    92  * [wiki:DeveloperQuickstart]
    93 
    94 === Model ===
    95 Defines databases in: {{{/models/module.py}}}
    96 
    97 The Models are loaded 1st within Web2Py processing, before the controllers.[[BR]]
    98 So you can import any global modules/set any global variables here.[[BR]]
    99 The Models are imported in alphabetical order, so we load the files which other modules depend on 1st, hence naming them appropriately:[[BR]]{{{000_config.py}}}, {{{01_crud.py}}}, {{{02_pr.py}}}, {{{03_gis.py}}}, etc
    100 
    101 === Controller ===
    102 Python functions in {{{/controllers/module.py}}} [[BR]]
    103 e.g.
    104 {{{
    105    def list_records():
    106        items = crud.select(table)
    107        return dict(items=items)
    108 }}}   
    109 
    110 === View ===
    111 HTML/Javascript templates in {{{/views/module/function.html}}}
    112  * these are normal HTML/JS files with the ability to add in Python code (e.g. variables) surrounded by brackets: {{ interpreted python here }}
    113  * there should be an .html file available for each function in the module (name normally being the same as the function)
    114  * these normally inherit from {{{views/layout.html}}} which also includes the !JavaScript from {{{views/*_ajax.html}}}
    115  * if there is no view defined then a default view will be displayed, which will show the values of all the data it can see, but not be formatted nicely
    116 
    117 Static CSS/Javascript files are stored in {{{/static}}}
    118 
    11989== Javascript ==
    12090 * W3Schools' basic JS: http://www.w3schools.com/js/