Skip to content

Commit

Permalink
Add dem_th_energy_per_capita_region property #38
Browse files Browse the repository at this point in the history
  • Loading branch information
4lm committed Jun 18, 2019
1 parent 06bf732 commit fe5430c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def dem_th_energy_region(self):
return round(result / 1e3)


class RegMunDemThEnergyPerCapita(RegMunDemThEnergy):
class RegMunDemThEnergyPerCapita(RegMunDemThEnergy, RegMunPopDensity):
name = 'reg_mun_dem_th_energy_per_capita'

class Meta:
Expand All @@ -273,6 +273,10 @@ class Meta:
def dem_th_energy_per_capita(self):
return round(self.dem_th_energy * 1e6 / self.mundata.pop_2017)

@property
def dem_th_energy_per_capita_region(self):
return round(self.dem_th_energy_region * 1e6 / self.pop_region)


class RegWaterProtArea(LayerModel):
name = 'reg_water_prot_area'
Expand Down
9 changes: 8 additions & 1 deletion templates/stemp_abw/popups/dem_th_energy_per_capita.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{% extends 'stemp_abw/popups/base_layer_popup.html' %}

{% block values %}: {{ layer.dem_th_energy_per_capita }} kWh pro EinwohnerIn{% endblock %}
{% block gen %}
<div class="cell">
<p>{{ layer.gen }}: {{ layer.dem_th_energy_per_capita }} kWh pro EinwohnerIn</p>
</div>
<div>
Region ABW: {{ layer.dem_th_energy_per_capita_region }} kWh pro EinwohnerIn
</div>
{% endblock %}

{% block vis %}
<div class="cell" style="height: 252px;">
Expand Down

0 comments on commit fe5430c

Please sign in to comment.