Exemplo n.º 1
0
    def itree_regions(self):
        from treemap.models import ITreeRegion  # prevent circular import

        if self.itree_region_default:
            codes = [self.itree_region_default]
        else:
            codes = ITreeRegion.objects.filter(geometry__intersects=self.bounds).values_list("code", flat=True)

        return [(code, ITREE_REGIONS.get(code, {}).get("name")) for code in codes]
Exemplo n.º 2
0
    def itree_regions(self):
        from treemap.models import ITreeRegion  # prevent circular import
        if self.itree_region_default:
            codes = [self.itree_region_default]
        else:
            codes = (ITreeRegion.objects.filter(
                geometry__intersects=self.bounds).values_list('code',
                                                              flat=True))

        return [(code, ITREE_REGIONS.get(code, {}).get('name'))
                for code in codes]
Exemplo n.º 3
0
 def get_default_for_region(cls, region_code):
     """
     Returns a new BenefitCurrencyConversion for the given i-Tree region
     """
     config = ITREE_REGIONS.get(region_code, {}).get("currency_conversion")
     if config:
         benefits_conversion = cls()
         benefits_conversion.currency_symbol = "$"
         for field, conversion in config.iteritems():
             setattr(benefits_conversion, field, conversion)
         return benefits_conversion
     else:
         return None
Exemplo n.º 4
0
 def get_default_for_region(cls, region_code):
     """
     Returns a new BenefitCurrencyConversion for the given i-Tree region
     """
     config = ITREE_REGIONS.get(region_code, {})\
                           .get('currency_conversion')
     if config:
         benefits_conversion = cls()
         benefits_conversion.currency_symbol = '$'
         for field, conversion in config.iteritems():
             setattr(benefits_conversion, field, conversion)
         return benefits_conversion
     else:
         return None
Exemplo n.º 5
0
 def __unicode__(self):
     "printed representation, used in templates"
     return "%s (%s)" % (self.code, ITREE_REGIONS.get(self.code,
                                                      {}).get('name'))
Exemplo n.º 6
0
 def __unicode__(self):
     "printed representation, used in templates"
     return "%s (%s)" % (self.code,
                         ITREE_REGIONS.get(self.code, {}).get('name'))