#300 Extend mail templates
* extends all relevant mail templates such that municipals of an entry will be shown in the mail
This commit is contained in:
@@ -276,6 +276,22 @@ class Geometry(BaseResource):
|
||||
|
||||
return parcels
|
||||
|
||||
def get_underlying_municipals(self, parcels=None):
|
||||
""" Getter for related municipals
|
||||
|
||||
If no QuerySet of parcels is provided, the parcels will be fetched
|
||||
|
||||
Returns:
|
||||
municipals (QuerySet): The related municipals as queryset
|
||||
"""
|
||||
from konova.models import Municipal
|
||||
|
||||
if parcels is None:
|
||||
parcels = self.get_underlying_parcels()
|
||||
municipals = parcels.order_by("municipal").distinct("municipal").values("municipal__id")
|
||||
municipals = Municipal.objects.filter(id__in=municipals).order_by("name")
|
||||
return municipals
|
||||
|
||||
def count_underlying_parcels(self):
|
||||
""" Getter for number of underlying parcels
|
||||
|
||||
|
||||
Reference in New Issue
Block a user