Changes between Initial Version and Version 1 of DeveloperGuidelines/Tutorial


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

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Tutorial

    v1 v1  
     1[[TOC]]
     2
     3= Tutorial =
     4
     5The following material from SahanaCamp1.2 may be useful:
     6 * [http://eden.sahanafoundation.org/attachment/wiki/SahanaCamp1.2/Sahana%20Eden%20-%20Developer%20Environment%20(VM).pdf Sahana Eden - Developer Environment (VM)]
     7 * [http://eden.sahanafoundation.org/attachment/wiki/SahanaCamp1.2/Sahana%20Eden%20-%20Introduction%20to%20the%20Code.pdf Sahana Eden - Introduction to the Code]
     8 * [http://eden.sahanafoundation.org/attachment/wiki/SahanaCamp1.2/Sahana%20Eden%20-%20Bug%20Reporting.pdf Sahana Eden - Bug Reporting]
     9 * [http://eden.sahanafoundation.org/attachment/wiki/SahanaCamp1.2/Sahana%20Eden%20-%20Localisation.pdf Sahana Eden - Localisation]
     10 * [wiki:DeveloperQuickstart]
     11
     12== Model ==
     13Defines databases in: {{{/models/module.py}}}
     14
     15The Models are loaded 1st within Web2Py processing, before the controllers.[[BR]]
     16So you can import any global modules/set any global variables here.[[BR]]
     17The 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
     18
     19== Controller ==
     20Python functions in {{{/controllers/module.py}}} [[BR]]
     21e.g.
     22{{{
     23   def list_records():
     24       items = crud.select(table)
     25       return dict(items=items)
     26}}}   
     27
     28== View ==
     29HTML/Javascript templates in {{{/views/module/function.html}}}
     30 * these are normal HTML/JS files with the ability to add in Python code (e.g. variables) surrounded by brackets: {{ interpreted python here }}
     31 * there should be an .html file available for each function in the module (name normally being the same as the function)
     32 * these normally inherit from {{{views/layout.html}}} which also includes the !JavaScript from {{{views/*_ajax.html}}}
     33 * 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
     34
     35Static CSS/Javascript files are stored in {{{/static}}}