def getAreasOfCountry(self, country):
     #Coupling of method interface with NDB-based model... remove.
     if not country.key.kind() == "Country":
         raise ValueError("key must refer to an instance of Country.")
     query = Area.query(ancestor=country.key).order(Area.name)
     areas = query.fetch()
     return areas
Beispiel #2
0
 def onGet(self, countryNameKey):
     self._country = Country.get_by_id(self.helper.getNormalisedCountryName(countryNameKey))
     if self._country is None:
         return
     self._areas = [y for y in Area.query(ancestor=self._country.key).fetch()]
 def getAreasOfCountryForId(self, countryId):
     query = Area.query(ancestor=ndb.Key("Country", countryId)).order(Area.name)
     areas = query.fetch()
     return areas