Changes between Version 28 and Version 29 of Usage/TemplatingDocumentation


Ignore:
Timestamp:
07/09/12 17:36:47 (12 years ago)
Author:
ramonb
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Usage/TemplatingDocumentation

    v28 v29  
    55CMT utilizes Django's Templating engine to process templates.
    66
    7 For a complete description of the DJango templating engine, please visit the DJango website here:
     7For a complete description of the Django templating engine, please visit the DJango website here:
    88 * [https://docs.djangoproject.com/en/dev/topics/templates/ The Django template language]
    99
     
    2323== arpanize ==
    2424
    25 Converts a IP (range) to reversed DNS style arpa notation
     25Converts an IP (range) to reversed DNS style ARPA notation
    2626
    2727'''Usage''':
     
    4040== base_net ==
    4141
    42 Converts a IP (range) to it's first 3 octects
     42Converts an IP (range) to it's first 3 octets
    4343
    4444'''Usage''':
     
    5757== ip_last_digit ==
    5858
    59 Converts a IP (range) to it's last octect
     59Converts an IP (range) to it's last octet
    6060
    6161'''Usage''':
     
    7979== assign ==
    8080
    81 Variable assignment within template
     81Concatenates any combination of (space separated) variable's and strings and assigns it to a new variable.
    8282
    8383'''Usage''':
     
    104104{{{
    105105{% getbasenets 'MY ADMIN' as network_basenets %}
     106
    106107{% for bnet in network_basenets %}
    107108{{ bnet }}
     
    124125
    125126'''Example's''':
    126  *
    127 {{{
    128 {% use HardwareUnit with 'cluster__name=Gina' as gina_hosts %}
    129 {% getracks 'Gina' as gina_racks %}
    130 
    131 {% for r in gina_racks %}
    132   {% assign filename = '/var/tmp/hosts.' r.label '.in' %}
    133 
    134   {% store filename %}
    135   {% noblanklines %}
    136 
    137 # Hosts file containing all hosts from rack: {{ r.label }}
    138 
    139   {% for h in gina_hosts %}
    140     {% if h.rack.label == r.label %}
    141 
    142 {{ h.label }}
    143 
    144     {% endif %}
    145   {% endfor %}
    146 
    147   {% endnoblanklines %}
    148   {% endstore %}
    149 
     127
     128Let's assume the cluster with name "TINA" consists of 3 racks with the labels: r1, r5, r6
     129
     130 *
     131{{{
     132{% getracks 'TINA' as tina_racks %}
     133
     134{% for r in tina_racks %}
     135{{ r.label }}
    150136{% endfor %}
    151137}}}
    152138
     139'''Example output''':
     140 *
     141{{{
     142r1
     143r5
     144r6
     145}}}
     146
    153147== use ==
    154148
    155 Compilation function to definine Querysets for later use.
     149Compilation function to define Querysets for later use.
    156150
    157151'''Usage''':
     
    198192== noblanklines ==
    199193
    200 Prevents any blanklines occuring in the resulting output (file).
     194Prevents any blanklines occurring in the resulting output (file).
    201195
    202196'''Section start''':