Changeset 12439 for trunk


Ignore:
Timestamp:
01/27/11 13:48:52 (13 years ago)
Author:
ramonb
Message:

templatetags/ramonb_extras.py:

  • getracks cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sara_cmt/sara_cmt/cluster/templatetags/ramonb_extras.py

    r12438 r12439  
    171171
    172172    """
    173         Something weird
     173        Get list of racks in a cluter
     174
     175        Usage: {% getracks <cluster> as <listname> %}
    174176    """
    175177
     
    181183
    182184    def render(self, context):
    183         attr='cluster__name'
    184         val =self.cluster
    185 
    186         rack_names = [ ]
    187185
    188186        cluster_units = get_model('cluster', 'HardwareUnit').objects.filter( cluster__name=str(self.cluster) )
    189187
    190188        for u in cluster_units:
    191             if u.rack.label not in rack_names:
    192                 rack_names.append( u.rack.label )
     189            if u.rack not in self.racks:
    193190                self.racks.append( u.rack )
    194191
Note: See TracChangeset for help on using the changeset viewer.